dongren1011 2014-10-12 13:03
浏览 376
已采纳

警告:strpos():空针... wordpress插件[关闭]

I get this error :

Warning: strpos(): Empty needle in ......popularity-contest.php on line 2574

function akpc_is_searcher() {
        global $akpc;
        $referrer = parse_url($_SERVER['HTTP_REFERER']);
        $searchers = explode(' ', preg_replace("
||
|
", ' ', $akpc->searcher_names));
        foreach ($searchers as $searcher) {
                if (strpos($referrer['host'], $searcher) !== false) {
                        return true;
                }
        }
        return false;
}

Can someone please help me to fix this problem?

  • 写回答

2条回答 默认 最新

  • dongmeng0317 2014-10-12 13:11
    关注

    The warning should go away if you set WP_DEBUG to false in wp_config.php. If you want to fix it, try the following:

    function akpc_is_searcher() {
            global $akpc;
            $referrer = parse_url($_SERVER['HTTP_REFERER']);
            $searchers = explode(' ', preg_replace("
    ||
    |
    ", ' ', $akpc->searcher_names));
            foreach ($searchers as $searcher) {
                    if ( ! empty($searcher) && strpos($referrer['host'], $searcher) !== false) {
                            return true;
                    }
            }
            return false;
    }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 L76k模块的GPS的使用
  • ¥15 请帮我看一看数电项目如何设计
  • ¥23 (标签-bug|关键词-密码错误加密)
  • ¥66 比特币地址如何生成taproot地址
  • ¥20 数学建模数学建模需要
  • ¥15 关于#lua#的问题,请各位专家解答!
  • ¥15 什么设备可以研究OFDM的60GHz毫米波信道模型
  • ¥15 不知道是该怎么引用多个函数片段
  • ¥30 关于用python写支付宝扫码付异步通知收不到的问题
  • ¥15 隐藏系统界面pdf的打印、下载按钮