我想用PHP删除网址,但我无法弄清楚如何做到这一点。 我想爆炸()但问题是,我可以使用什么参数? 因为我需要让每一段网址都在以后使用它 脚本。
我特别需要拆分这部分:
它还需要工作时www。不见了。
示例:
http://www.thiswebsite.com/thispage.php?this=parameter&thisis_anotherone
然后我想我可以计算网址的字符,但它也可能是https,所以我的计划失败了。
有人能给我一些建议吗?它看起来很简单,但我无法理解......
答案 0 :(得分:3)
print_r(parse_url('http://www.thiswebsite.com/thispage.php?this=parameter&thisis_anotherone'));
Array ( [scheme] => http [host] => www.thiswebsite.com [path] => /thispage.php [query] => this=parameter&thisis_anotherone )
答案 1 :(得分:0)
另一种效率较低的方法
if(substr($url, 0, 5) == "https"){
$part1 = "https://";
$part2 = substr($url, 8); }
else {
$part1 = "http://";
$part2 = substr($url, 7); }