helpers\BaseFileHelper normalizePath()

normalizePath() public static method

Normalizes a file/directory path.

The normalization does the following work:

  • Convert all directory separators into DIRECTORY_SEPARATOR (e.g. "\a/b\c" becomes "/a/b/c")
  • Remove trailing directory separators (e.g. "/a/b/c/" becomes "/a/b/c")
  • Turn multiple consecutive slashes into a single one (e.g. "/a///b/c" becomes "/a/b/c")
  • Remove ".." and "." based on their meanings (e.g. "/a/./b/../c" becomes "/a/c")
public static string normalizePath ( $path, $ds = DIRECTORY_SEPARATOR )
$path string

The file/directory path to be normalized

$ds string

The directory separator to be used in the normalized result. Defaults to DIRECTORY_SEPARATOR.

return string

The normalized file/directory path

doc_Yii
2016-10-30 17:04:45
Comments
Leave a Comment

Please login to continue.