對不起,我有點新的正則表達式,反正我有一個像http://example.com/test/folder/?get=ThisisaValue
這樣的網址,我需要它返回單詞「get」是否在那裏。使用preg_match查找URL中的單詞(或字符串不包含空格)
每當我運行該函數,我得不到任何匹配?任何幫助表示感謝你。
示例代碼,讓我們說$_SERVER['HTTP_REFERER']
是http://example.com/hello/?state=12345
if(preg_match("state", $_SERVER['HTTP_REFERER'])) {
echo "match";
} else {
echo "no match";
}
又有什麼功能? – Utkanos
對不起,我只是表示函數preg_match。基本上我的代碼是: 'preg_match(「get」,「http://example.com/test/folder/?get=ThisisaValue」) – user1599318