Home >php教程 >php手册 >php Warning:strstr()[function.strstr]:Empty delimiter

php Warning:strstr()[function.strstr]:Empty delimiter

WBOY
WBOYOriginal
2016-06-13 09:57:11932browse

今天在使用php中strstr函数时提示Warning:strstr()[function.strstr]:Empty delimiter错误了,后来经过反复查找得出解决办法,有需要的同学可参考。

Warning: strstr() [function.strstr]: Empty delimiter

非常奇怪,难道php函数strstr的某个参数出问题了?

于是写了个测试的例子

 代码如下 复制代码

$text=”asdfghjklqwertyuiopzxcvbnm”;
//$key=”g”;

//根据php错误提示Empty delimiter,判断应该不会是$text的值出问题,所以故意注释了key值

if(strstr($text, $key)){
echo “found it”;
}else{
echo “not found”;
}

?>

strstr()竟然不报错,于是想到$key值可能会是空串”",姑且一试。

果然strstr($text,”")时,提示出错Warning: strstr() [function.strstr]: Empty delimiter

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn