2010-12-07 101 views
0

我有一个使用strpos()方法,并在一个网站上,我得到这个错误插件警告:strpos()[function.strpos]:空分隔符

Warning: strpos() [function.strpos]: Empty delimiter. in /home/mysite/public_html/wp-includes/compat.php on line 55 

任何想法的可能原因这可能是?

从compat.php

if (!function_exists('stripos')) { 
function stripos($haystack, $needle, $offset = 0) { 
    return strpos(strtolower($haystack), strtolower($needle), $offset); 
} 
} 

我的代码片段...

function myFunction($thePost) 
    { 
     $theContent = $thePost->post_content; 
     $myVar1 = array(); 
     preg_match_all('/<a\s[^>]*href=\"([^\"]*)\"[^>]*>(.*)<\/a>/siU',$theContent,$myVar1); 
     $myVar2 = 0; 
     foreach ($myVar1[1] as $myVar3) 
     { 
      $myVar4 = $myVar1[2][$myVar2]; 
      $myVar5 = FALSE; 
      $myVar6 = get_bloginfo('wpurl'); 
      $myVar7 = str_replace('http://www.','',$myVar3); 
      $myVar7 = str_replace('http://','',$myVar7); 
      $myVar8 = str_replace('http://www.','',$myVar6); 
      $myVar8 = str_replace('http://','',$myVar8); 
      if (strpos($myVar3,'http://')!==0 || strpos($myVar7,$myVar8)===0) return TRUE; 
      $myVar2++; 
     } 
     return FALSE; 
    } 
+0

请发布您的php代码,我们无法猜测您对此功能的使用 – 2010-12-07 04:12:12

+3

并且您是否已经在/home/mysite/public_html/wp-includes/compat.php的第55行找到了_looked_?我的心理调试技能与Raymond Chen的不匹配,但即使我可以找出这可能是最好的开始:-) – paxdiablo 2010-12-07 04:12:50

回答

3

东西是传递一个空字符串作为第二个参数WordPress的实施stripos()(它不是代码你粘贴在上面)。

我可以问你为什么使用PHP 4?

0

试穿变量

变化对ADDING双引号这一行: 如果(strpos($ myVar3,!的 'http://')== 0 || strpos($ myVar7,$ myVar8) === 0)返回TRUE;

到: 如果(strpos( 'HTTP://' “$ myVar3。 ”! “$ myVar8”)== 0 || strpos(“。$ myVar7”)=== 0)返回TRUE;