2010-12-07 25 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;

相關問題