2016-03-05 32 views
0

我有一個名爲$user的變量,它在URL中獲取?u=之後的值。有沒有辦法將當前頁面的URL放入if語句中?

我想設置它是這樣一個條件 - if the value after the ?u= in the URL is equal to $user, then do this ...

但我不知道,我怎麼可以得到當前頁面的URL。它甚至有可能嗎?

+0

結帳[parse_url()](http://php.net/manual/en/function.parse-url.php),以獲得關於URL信息,以及URL參數[$ _GET](http://php.net/manual/en/reserved.variables.get.php) –

回答

0

試試這個代碼:

echo $_GET["u"]; 
0
$u=$_GET['u']; 
if ($user==$u){ 
//Your Code 
} 
相關問題