WP_CLI\Utils
normalize_path()
Normalize a filesystem path.
On Windows systems, replaces backslashes with forward slashes and forces upper-case drive letters. Allows for two leading slashes for Windows network shares, but ensures that all other duplicate slashes are reduced to a single one. Ensures upper-case drive letters on Windows systems.
Хуков нет.
Возвращает
Строку
. Normalized path.
Использование
normalize_path( $path );
- $path(строка) (обязательный)
- Path to normalize.
Код normalize_path() normalize path WP-CLI 2.8.0-alpha
function normalize_path( $path ) { $path = str_replace( '\\', '/', $path ); $path = preg_replace( '|(?<=.)/+|', '/', $path ); if ( ':' === substr( $path, 1, 1 ) ) { $path = ucfirst( $path ); } return $path; }