问题
I need extract item id from url's like these (number after last slash)
http://codecanyon.net/item/test item/12219820
//^^^^^^^^
http://codecanyon.net/item/another item/75219586
//^^^^^^^^
http://codecanyon.net/item/item contain number v1.2/74419586
//^^^^^^^^
Some items has digits in name. How i can extract just id at end of links with regular expression in php?
回答1:
This should work for you:
(Just take the last part of the url (string) with basename())
echo basename($url);
来源:https://stackoverflow.com/questions/29654766/how-do-i-get-the-last-part-of-an-url-string