php匹配關鍵字跳轉頁面
strstr函數搜索要從目標字符串中搜索的字符串;strstr函數僅用於檢查字符串是否存在;strstr函數的用法如下。
<?php $b='or'; $name=$_GET['name']; if(strstr($name,$b)){ //echo "111111"; //include_once $PIKA_ROOT_DIR."500.html"; header("Location:https://www.baidu.com"); exit; }else{ echo "00000";} ?>
例如,如果執行strstr(“abcdefg”,“cde”),它將從abcdefg中搜索cde。如果通過搜索存在相應的字符串,則返回“目標字符串”,否則返回false。
如果要在不區分大小寫的情況下進行搜索,可以使用“stristr函數”來執行此操作。