stristr($post['message'],$t1)=== FALSE
给出了结果列表,但我需要stristr($post['message'],$t1)=== TRUE
,只能得到1个结果!
帮助PLZ。,
CODE:
foreach($page_posts['data'] as $post){
if(!(stristr($post['message'],$t1)=== FALSE) && $t1!==" ")
{
$message = (($post['message']) ? $post['message'] : " ");
$i++;
print($message);
}
与stristr($post['message'],$t1)=== TRUE
相同,即;仅给出一个结果〜
答案 0 :(得分:2)
stristr不会返回布尔值TRUE ...当找到您要查找的字符串时,它将返回字符串。否则,它将返回布尔值FALSE。
用stristr测试($ post ['message'],$ t1)=== TRUE是错误的。
答案 1 :(得分:0)
使用stripos,而不是stristr。
if(stripos($post['message'], $t1) > -1) {
// needle is in haystack
}