究竟是什么

return (empty($neededRole) || strcasecmp($role, 'admin') == 0 || strcasecmp($role, $neededRole) == 0);

||究竟是什么? 在这个声明中意思? 有人可以把这个英文给我。

我保证我已经搜索了这个,但我想我不知道该怎么去google,因为我找不到任何东西。

谢谢:)


它是OR逻辑运算符。

http://www.php.net/manual/en/language.operators.logical.php


使用Google搜索符号总是很难。 别担心: || 意味着or在声明中。 不要混淆Xor ,它略有不同:

  • or|| 是指A or B or A + B
  • xor是指A or B, not both
  • 参考文献:

  • 逻辑运算符

  • 这是一个OR操作符。 如果它的任何一个“参数”是真的,这是真的。

    链接地址: http://www.djcxy.com/p/1815.html

    上一篇: What exactly does

    下一篇: ' In A Function Argument Do?