PHPにおけるパスの処理
parse_url
$array = parse_url("http://username:password@hostname/path?arg=value#anchor");
print_r($array);
結果
Array
(
[scheme] => http
[host] => hostname
[user] => username
[pass] => password
[path] => /path
[query] => arg=value
[fragment] => anchor
)
$array = parse_url("https://www.example.com/aaaa/bbbb/cccc.php");
print_r($array);
結果
Array
(
[scheme] => https
[host] => www.example.com
[path] => /aaaa/bbbb/cccc.php
)
pathinfo
$array = pathinfo("/aaaa/bbbb/cccc.php");
print_r($array);
Array
(
[dirname] => /aaaa/bbbb
[basename] => cccc.php
[extension] => php
[filename] => cccc
)