Today, when using the strstr function in php, it prompted Warning: strstr()[function.strstr]: Empty delimiter is wrong. Later, after repeated searches, I found a solution. Students in need can refer to it.
Warning: strstr() [function.strstr]: Empty delimiter
Very strange, is there something wrong with one of the parameters of the php function strstr?
So I wrote a test example
The code is as follows
代码如下 |
复制代码 |
$text=”asdfghjklqwertyuiopzxcvbnm”;
//$key=”g”;
//根据php错误提示Empty delimiter,判断应该不会是$text的值出问题,所以故意注释了key值
if(strstr($text, $key)){
echo “found it”;
}else{
echo “not found”;
}
?>
|
|
Copy code
|
| $text=”asdfghjklqwertyuiopzxcvbnm”;
//$key=”g”;
//According to the PHP error prompt Empty delimiter, it was judged that there should not be a problem with the value of $text, so the key value was deliberately annotated
if(strstr($text, $key)){
echo “found it”;
}else{
echo “not found”;
}
?>
strstr() did not report an error, so I thought that the $key value might be an empty string "", so I gave it a try.
Sure enough, when strstr($text,""), an error message appears: Warning: strstr() [function.strstr]: Empty delimiter
www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/632095.htmlTechArticleToday when using the strstr function in php, it prompted Warning: strstr()[function.strstr]: Empty delimiter error , and later after repeated searches, a solution was found. Students in need can refer to it. Wa...
Statement of this Website
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