我在我的网站上使用以下声明。我想说出selected_plan_id是4、5还是6。我使用的任何OR变体都会破坏我的代码。
<?php if($CURRENT_USER['selected_plan_id'] == '5'): ?>
这是我到目前为止尝试过的:
<?php if($CURRENT_USER['selected_plan_id'] == '5' or '4' or '6'): ?>
:( 错误
<?php if($CURRENT_USER['selected_plan_id'] == '"5", "4", "6"'): ?>
:(为每个用户显示此
<?php if($CURRENT_USER['selected_plan_id'] == '5'): or if($CURRENT_USER['selected_plan_id'] == '4'): or if($CURRENT_USER['selected_plan_id'] == '6'): ?>
:( 错误
使用||
声明。
<?php if($CURRENT_USER['selected_plan_id'] == '4' || $CURRENT_USER['selected_plan_id'] == '5' || $CURRENT_USER['selected_plan_id'] == '6'): ?>
或者
使用in_array()
。
$arr = Array (4,5,6);
<?php if(in_array($CURRENT_USER['selected_plan_id'],$arr)): ?>
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句