我不是很好的正則表達式,因爲我還沒有來充分了解它如何努力獲得正確的結果。我需要一個正則表達式或php函數去掉url的開頭,以獲得最後一個沒有變量的位。
輸入: HTTP:// www.site.com/more/more/thepartidneed?part=Idontneed
其他輸入:www.site.com/more/more/thepartineed?partidontneed
其他輸入:site.com/more/more/partineed
所需結果剝離後: 「thepartineed」
這可能嗎?
其它更多的重複:http://stackoverflow.com/search?q=get+last+path+in+url+php - 請在提問之前使用搜索功能。 [我們希望你做研究。](http://stackoverflow.com/questions/ask-advice) – Gordon
我道歉,我不能拿出「路徑」一詞。 :\ – Darius
請參閱:[parse_url()](http://us2.php.net/manual/en/function.parse-url.php)。應該很容易...... – ircmaxell