或者PHP中的条件-我想我是对的,但可能不是

或者PHP中的条件-我想我是对的,但可能不是,php,Php,我在PHP中使用了以下命令或条件。我想我是对的,但我不确定。有很多文章有这么多不同的方法,这让我有点困惑 if ($SpecialProductType == 'dronecourseground' || 'dronecoursesafety') { 这是我的条件,如果$SpecialProductType的值是dronecourseground或dronecoursesafety,则执行该操作 我是不是遗漏了什么 多谢各位 if ($SpecialProductType == 'dronec

我在PHP中使用了以下命令或条件。我想我是对的,但我不确定。有很多文章有这么多不同的方法,这让我有点困惑

if ($SpecialProductType == 'dronecourseground' || 'dronecoursesafety') {
这是我的条件,如果$SpecialProductType的值是dronecourseground或dronecoursesafety,则执行该操作

我是不是遗漏了什么

多谢各位

if ($SpecialProductType == 'dronecourseground' || $SpecialProductType == 'dronecoursesafety') {
是有效代码。上述语法也是正确的,但会导致错误的结果


是有效代码。上述语法也是正确的,但会导致错误的结果。

if($SpecialProductType=='dronecourseground'.\124;$SpecialProductType=='dronecoursesafety'){
if(在数组中($SpecialProductType,['dronecourseground','dronecoursesafety']){
if($SpecialProductType=='dronecourseground'| |$SpecialProductType=='dronecoursesafety'){
如果(在数组中($SpecialProductType、['dronecourseground'、'dronecoursesafety')){
…上述内容无效…代码也有效,但在当前情况下,它不会导致所需的比较…这已在注释中解决,但在答案中没有解决:)@GetSetSeems like jackingok我没有和你争论再见…上面的不是…代码也是有效的,但在当前情况下,它不会导致所需的比较…这已经在注释中解决了,但在答案中没有:)@GetSetSeems like jackingok我没有和你争论再见