parse_url 解析 URL 返回数组

最后更新于:2022-04-02 02:28:53

[TOC] ## 实例 ## 基础实例 ``` $url = 'http://username:password@hostname/path/foo/?arg=value#anchor'; print_r(parse_url($url)); //Array //( // [scheme] => http // [host] => hostname // [user] => username // [pass] => password // [path] => /path/foo/ // [query] => arg=value // [fragment] => anchor //) // 只获取 url_path echo parse_url($url, PHP_URL_PATH); ```
';