php Warning:strstr()[function.strstr]:Empty delimiter_PHP教程

來源:互聯網
上載者:User
今天在使用php中strstr函數時提示Warning:strstr()[function.strstr]:Empty delimiter錯誤了,後來經過反覆尋找得出解決辦法,有需要的同學可參考。

Warning: strstr() [function.strstr]: Empty delimiter

非常奇怪,難道php函數strstr的某個參數出問題了?

於是寫了個測試的例子

代碼如下 複製代碼

$text=”asdfghjklqwertyuiopzxcvbnm”;
//$key=”g”;

//根據php錯誤提示Empty delimiter,判斷應該不會是$text的值出問題,所以故意注釋了key值

if(strstr($text, $key)){
echo “found it”;
}else{
echo “not found”;
}

?>

strstr()竟然不報錯,於是想到$key值可能會是空串”",姑且一試。

果然strstr($text,”")時,提示出錯Warning: strstr() [function.strstr]: Empty delimiter

http://www.bkjia.com/PHPjc/632095.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/632095.htmlTechArticle今天在使用php中strstr函數時提示Warning:strstr()[function.strstr]:Empty delimiter錯誤了,後來經過反覆尋找得出解決辦法,有需要的同學可參考。 Wa...

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.