php if语句位于另一个php if语句中

时间:2018-11-28 15:11:29

标签: php html html5 if-statement

如果$ws_user_status是培训师或管理员,我想显示整个代码,但是在此我想在另外两个if语句上分开代码... 如果$ws_total_sales > 0显示信息消息,否则($ws_total_sales == 0)显示包含所有内容项的表

但是我出了点问题...桌子一直可见...

<?php
$ws_user_status = 'administrator';
$ws_total_sales = 5;
?>

<?php if ($ws_user_status == 'trainer' || $ws_user_status == 'administrator') : ?>
<?php if ($ws_total_sales > 0) : ?>
<div class="woocommerce-info">
    <?php _e( 'You do not have any items to sell.', 'woocommerce' ); ?>
</div>
<?php else : ?>
<div>
<div class="alert alert-info">
    <?php _e( 'Your sales.', 'woocommerce' ); ?>
</div>      
      <table class="table table-hover">
        <thead>
          <tr>
            <th>Item</th>
            <th>Total sale</th>
            <th>Your profit</th>
          </tr>
        </thead>
        <tbody>
          <tr>
            <td>Item 1 name</td>
            <td>100</td>
            <td>75000</td>
          </tr>
          <tr>
            <td>Item 2 name</td>
            <td>100</td>
            <td>60000</td>
          </tr>
          <tr>
        </tbody>
      </table>
</div>  
<?php endif; ?>
<?php endif; ?>

0 个答案:

没有答案
相关问题