我想检查url,看看它是否包含某个值。如果是,运行代码。下面是我的url的样子:
www.url.com/test/stats.php?player=neo
www.url.com/test/stats.php?player=morpheus
www.url.com/test/stats.php?player=anderson
$userName = $_GET['player'];
我想做一些像
if ( urlheader contains $userName ) {
//run some code
}
我认为你想要做的是。然而,它将不工作与$_POST
if($_GET['player']){
$username = $_GET['player']
//Do your stuff with $username here
}
试试下面的内容
$userName = $_GET['player'];
if (strpos($url,$userName) !== false) {
//your scripts
}
或
$userName = $_GET['player'];
if($userName == 'Your checking value')
{
//your scripts
}