有没有人能帮我写一下下面的代码
if ($scope = '9001') $docref = $rs["9001ref"]; 
elseif ($scope = '14001') $docref = $rs["14001ref"];
elseif ($scope = '18001') $docref = $rs["18001ref"]; 
elseif ($scope = '9001,14001') $docref = $rs["914001ref"]; 
elseif ($scope = '9001,18001') $docref = $rs["918001ref"]; 
elseif ($scope = '14001,18001') $docref = $rs["1418001ref"]; 
elseif ($scope = '9001,14001,18001') $docref = $rs["91418001ref"];我不确定我应该使用=还是==
我也不确定我应该用‘’还是“”
谁能让我知道,并提供一个简短的解释,以便我知道下一步,谢谢。
发布于 2014-10-07 15:54:25
在监狱里一定要有==
if ($scope = '9001') $docref = $rs["9001ref"]; 
elseif ($scope == '14001') $docref = $rs["14001ref"];
elseif ($scope == '18001') $docref = $rs["18001ref"]; 
elseif ($scope == '9001,14001') $docref = $rs["914001ref"]; 
elseif ($scope == '9001,18001') $docref = $rs["918001ref"]; 
elseif ($scope == '14001,18001') $docref = $rs["1418001ref"]; 
elseif ($scope == '9001,14001,18001') $docref = $rs["91418001ref"];对于这种情况,更好的解决方案是使用switch而不是if-elseif条件。
https://stackoverflow.com/questions/26231103
复制相似问题