During normalization, all slashes are replaced by forward slashes ("/").
Furthermore, all "." and ".." segments are removed as far as possible.
".." segments at the beginning of relative paths are not removed.
php
echo Path::canonicalize("\webmozart\puli\..\css\style.css");
=> /webmozart/css/style.css
echo Path::canonicalize("../css/./style.css");
=> ../css/style.css
This method is able to deal with both UNIX and Windows paths.
public static canonicalize ( string $path ) : string | ||
$path | string | A path string. |
return | string | The canonical path. |