我有一些代码使用stristr函数来提取我需要的数据.
它为循环的每次迭代提供了这个警告:
Warning: stristr() [function.stristr]: Empty delimiter in ... line 55
Run Code Online (Sandbox Code Playgroud)
代码与此警告不同.这是代码:
$data = stristr("$text", "$key");
$result = string_limit_words($data,2);
print "$result<BR>";
Run Code Online (Sandbox Code Playgroud)
如何摆脱警告信息?
$data = $text;
if($key)
$data = stristr($data, $key);
$result = string_limit_words($data,2);
print "$result<BR>";
Run Code Online (Sandbox Code Playgroud)
基本上只有当$ key(针)不是空字符串时才执行stristr
| 归档时间: |
|
| 查看次数: |
4541 次 |
| 最近记录: |