関数 path_is_absolute()
定義ファイル :/blog/wp-includes/functions.php 9
path_is_absolute()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | /** * Test if a give filesystem path is absolute. * * For example, '/foo/bar', or 'c:\windows'. * * @since 2.5.0 * * @param string $path File path. * @return bool True if path is absolute, false is not absolute. */ function path_is_absolute( $path ) { /* * This is definitive if true but fails if $path does not exist or contains * a symbolic link. */ if ( realpath($path) == $path ) return true; if ( strlen($path) == 0 || $path[0] == '.' ) return false; // Windows allows absolute paths like this. if ( preg_match('#^[a-zA-Z]:\\\\#', $path) ) return true; // A path starting with / or \ is absolute; anything else is relative. return ( $path[0] == '/' || $path[0] == '\\' ); } |