if in_array 的条件为布尔值
所以我有一个 in_array 检查,名为
if (in_array('pageLevel',$userlevels))
Which I Want to connect to a boolean,如 $hasAccess
这样我就可以应用
if ($hasAccess == true) { do something }
我尝试过 if (in_array('pageLevel',$userlevels)) { $ hasAccess == true }
但这似乎不起作用。谁能告诉我如何使用这个?
So I have an in_array check, called
if (in_array('pageLevel',$userlevels))
Which I want to connect to a boolean, like $hasAccess
so I can apply
if ($hasAccess == true) { do something }
I tried if (in_array('pageLevel',$userlevels)) { $hasAccess == true }
but that does not seem to work. Can anyone tell me how to use this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
应为
$hasAccess = true
。或者Should be
$hasAccess = true
. Or尝试
$hasAccess = true;
您需要分配给变量 (=
),而不是仅仅比较它 (==
) 并抛出结果走了。Try
$hasAccess = true;
You need to assign to the variable (=
), rather than just compare it (==
) and throw the result away.