我想用php返回URL的特定部分。例如,如果網址是:返回URL的特定部分
http://website.com/part1/part2/part3/detail/page_id/number/page/2
或
http://website.com/part1/part2/part3/detail/page_id/number/page/3
我想回數。
可以嗎?
$pattern = "/\d+$/";
$input = "http://website.com/part1/part2/part3/detail/page_id/number/page/2";
preg_match($pattern, $input, $matches);
$post_id = $matches[8];
http://stackoverflow.com/questions/6985505/get-part-of-url –
非常感謝你@PeterPopelyshko – AFN