实例

<?php 
$url = 'http://www.lykep.com/index.php/archives/341/';
$arr = parse_url($url);
print_r($arr);

返回内容

Array
(
    [scheme] => http
    [host] => www.lykep.com
    [path] => /index.php/archives/341/
)

调用

echo $host = $arr['host'];
Last modification:September 19th, 2019 at 05:12 pm
如果觉得我的文章对你有用,请随意赞赏