零艺

【笔记】PHP拆分url并提取域名、方法、参数
<?php $url = 'http://www.lykep.com/index.php/archives...
扫描右侧二维码阅读全文
05
2019/08

【笔记】PHP拆分url并提取域名、方法、参数

实例

<?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:August 5th, 2019 at 08:43 pm
If you think my article is useful to you, please feel free to appreciate

Leave a Comment