有没有人知道我可以使用的任何其他方式(旁边的@strpos())忽略从strpos()显示的错误消息(警告:strpos()[function.strpos]:偏移量不包含在字符串中... .)
而不是做这样的事情:
$pos = strpos($haystack, $needle, $offset);
Run Code Online (Sandbox Code Playgroud)
做点什么
if($offset < strlen($haystack))
$pos = strpos($haystack, $needle, $offset);
else
$pos = false; // Mimics the actual output of strpos
Run Code Online (Sandbox Code Playgroud)
希望这可以帮助!
| 归档时间: |
|
| 查看次数: |
183 次 |
| 最近记录: |