if($hhh == $abc ) {
return 'error';
}
我把它改成 if(strpos($abc, $hhh)) {
return 'error';
}
本来是要$hhh完全等于$abc , 现在我是想只要$abc含有$hhh 就return但这改了都不行,...这怎办啊???
return 'error';
}
我把它改成 if(strpos($abc, $hhh)) {
return 'error';
}
本来是要$hhh完全等于$abc , 现在我是想只要$abc含有$hhh 就return但这改了都不行,...这怎办啊???
return 'error';
}
<?php
$abc = "aabbccdd";
$hhh = "bcc";
print_r(strpos($abc, $hhh));
if(strpos($abc, $hhh)) {
echo "error";
return 'error';
}
?>print_r能够打出3
函数中能够打出error!是不是别的地方有语法错误啊?
我在官网上看到这样写道:WarningThis function may return Boolean FALSE, but may also return a non-Boolean value which evaluates to FALSE, such as 0 or "". Please read the section on Booleans for more information. Use the === operator for testing the return value of this function.所以用绝对不等于不太好吧?