WEIRD解析错误:语法错误,意外的`'if'(T_IF)ERROR`

时间:2019-08-08 07:11:03

标签: php parsing if-statement

我遇到此错误消息:

WEIRD Parse error: syntax error, unexpected 'if' (T_IF) ERROR LINE 11

代码是这样的:

foreach($admins as $admin){ 
echo "
    <tbody>
        <tr>
            <td>".++$menuCounter."</td>
            <td><a href='adminprofile.php?user_name=".$admin['user_name']."'>".$admin['user_name']."</a>
            </td>
            <td><a id='myModal1' href='mailto:".$admin['email_address']."' target='_top'>".$admin['email_address']."</td>
            <td>".$admin['date_joined']."</td>
            <td>".$admin['group_admin']."</td>
            <td>";if($admin['admin_level'] == 0 || if($admin['admin_level'] == 1 || $admin['admin_level'] == 9)
            { 
                echo "<a href='admindelete.php?table_id=".$admin['table_id']."'><span class='label label-danger'>REMOVE</span></a></td>";
            }
            else
            {
                echo "";
            } 
            echo "
        </tr>
    </tbody>
";  
}

第11行是:

<td>";if($admin['admin_level'] == 0 || if($admin['admin_level'] == 1 || $admin['admin_level'] == 9)

那是什么问题?

1 个答案:

答案 0 :(得分:0)

您可以在同一if语句中使用多个条件 更改

 if($admin['admin_level'] == 0 || if($admin['admin_level'] == 1 || $admin['admin_level'] == 9)

收件人

if($admin['admin_level'] == 0 || $admin['admin_level'] == 1 || $admin['admin_level'] == 9)