When using the strstr function in php today, the following error message is displayed: Warning: strstr () [function. strstr]: Empty delimiter. Later, the solution is found repeatedly. If you need it, you can refer to it.
Warning: strstr () [function. strstr]: Empty delimiter
Strange: Is there a problem with a parameter in strstr of the php function?
So I wrote a test example.
The Code is as follows: |
Copy code |
<? Php $ Text = "asdfghjklqwertyuiopzxcvbnm "; // $ Key = "g "; // According to the php error prompt Empty delimiter, it is determined that the value of $ text should not have a problem, so the key value is intentionally commented If (strstr ($ text, $ key )){ Echo "found it "; } Else { Echo "not found "; } ?> |
Strstr () does not return an error. Therefore, the $ key value may be an empty string "". Just try again.
Sure enough, when strstr ($ text, "") is displayed, the error Warning: strstr () [function. strstr]: Empty delimiter is prompted.