无法工作

时间:2016-04-25 12:03:49

标签: php

我很困惑。这么简单的事情。它只是不会“elseif”

我需要的只是:<?php if ( $pscorelabel >= 21 ) : ?>做了一些事情:<?php if ( $pscorelabel >= 42 ) : ?>做了别的事。

我附上了代码段。请,我是一个菜鸟,需要你的帮助。任何帮助将不胜感激。

<?php if ( $showscore == '1' ) : ?> 
<div class="ipt_fsqm_up_number">
<h6>
<?php $ui->print_icon_by_class( 'quill', false ); ?>
<?php printf( __( '%2$s%% Average %1$s', 'ipt_fsqm' ), $scorelabel, number_format_i18n( ($avg_score * 100), 0 ) ); ?>
</h6>

<?php endif; ?>

<?php if ( $pscorelabel >= 21 ) : ?>  <div class="ipt_fsqm_up_meta">
<h6><?php $ui->print_icon_by_class( 'quill', false ); ?>
<?php printf( __( '%2$s Total CPD Points %1$s', 'ipt_fsqm' ), $finallabel, number_format_i18n( ($pscorelabel * 1), 0 ) ); ?>
</h6>
<?php elseif ( $pscorelabel >= 42 ) : ?>                                                                                            
<div class="ipt_fsqm_up_meta">
<h6><?php $ui->print_icon_by_class( 'quill', false ); ?>
<?php printf( __( '%2$s Total CPD Points %1$s', 'ipt_fsqm' ), $finallabel, number_format_i18n( $finallabel = 6, 0 ) ); ?>
</h6>

<?php endif; ?> 

1 个答案:

答案 0 :(得分:1)

更新您的代码,将&gt; 42条件置于上方&amp;那么&gt; 21条件

  <?php 
    if ( $pscorelabel >= 42 ) { ?>                                                                                            
    <div class="ipt_fsqm_up_meta">
    <h6><?php $ui->print_icon_by_class( 'quill', false ); ?><?php printf( __( '%2$s Total CPD Points %1$s', 'ipt_fsqm' ), $finallabel, number_format_i18n( $finallabel = 6, 0 ) ); ?></h6>

    <?php

   } elseif ( $pscorelabel >= 21 ) { ?>  <div class="ipt_fsqm_up_meta">
    <h6><?php $ui->print_icon_by_class( 'quill', false ); ?><?php printf( __( '%2$s Total CPD Points %1$s', 'ipt_fsqm' ), $finallabel, number_format_i18n( ($pscorelabel * 1), 0 ) ); ?></h6>


    <?php } ?> 
相关问题