警告:strpos() [function.strpos]:foreach 语句中的分隔符为空 [英] Warning: strpos() [function.strpos]: Empty delimiter in foreach statement

查看:31
本文介绍了警告:strpos() [function.strpos]:foreach 语句中的分隔符为空的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已阅读有关 strpos() 问题的所有主题,但找不到可以解决我的问题的主题.所以这是代码.

I have read all topics regarding strpos() issues but I cant find one that will fix mine. So here is the code.

foreach($titles_array as $k=>$v) {
if(strpos($subject,$v) !== false) {
        $i++;
    $asd[$titles['id']] = $i;   
}
}

脚本运行良好,我得到了我正在寻找的结果,但出现了这个错误:警告:strpos() [function.strpos]:空分隔符

The script works good and I get the results I'm looking for but this error comes up : Warning: strpos() [function.strpos]: Empty delimiter

我读到它可能是数组中的空字符串或值,但我已经检查了它们,但没有找到任何空字符串/值.我很感激任何帮助.一切顺利!

I read that it might be an empty string or value in array but I've checked them both and I didnt found any empty string/value. I appreciate any help. All the best !

推荐答案

strpos 的第二个参数为空时,会出现空分隔符"警告.$titles_array 中肯定有一个空值.

The "empty delimiter" warning occurs when the second parameter to strpos is empty. You definitely have an empty value in $titles_array.

我在这里复制了警告:http://3v4l.org/RnU3q

foreach 循环之前尝试 print_r($titles_array).

Try print_r($titles_array) right before your foreach loop.

这篇关于警告:strpos() [function.strpos]:foreach 语句中的分隔符为空的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆