我使用codeigniter.I想要在网站内容中搜索几个单词,那是否存在它的单词在它的网站或没有?如果网站返回中存在一个单词(所有单词)为FALSE。我尝试了下面的代码,但得到错误。如何做到这一点?在网站内容中搜索php
DEMO:http://codepad.viper-7.com/rFiL01
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,'stackoverflow.com');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$contents = curl_exec($ch);
curl_close($ch);
$link[] = array("Questions", "Favorite", "myfoodho");
foreach($link as $val){
stristr($contents,$val); // Line 148
//if(){
// return true;
//}else{
// return false;
//}
}
?>
错误:
A PHP Error was encountered
Severity: Warning
Message: stristr() [function.stristr]: needle is not a string or an integer
Filename: views/exchange.php
Line Number: 148