所以,我在一个字符串中有这个 URL:
http://www.domain.com/something/interesting_part/?somevars&othervars
在 PHP 中,除了 interesting_part
之外,我如何摆脱所有?
最佳答案
...
$url = 'http://www.domain.com/something/interesting_part/?somevars&othervars';
$parts = explode('/', $url);
echo $parts[4];
输出:
interesting_part
关于php - 如何在 PHP 中提取 URL 的一部分以删除特定部分?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2873390/