path_is_absolute()

 

File: wp-includes/functions.php

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] == '//' );
}

参数:path_is_absolute( string $path )

例如,‘/foo/bar’或‘c:/windows’。

File path.

(bool)如果路径是绝对的,则为真;如果路径是绝对的,则为假。

$path

(string)
(Required)
File path.

{acontent3}

You must log in before being able to contribute a note or feedback.

16.67% (1) 次Baidu访问
16.67% (1) 次Google访问
66.67% (4) 次Sogou访问
  • 蜘蛛:Baidu,1次,更新时间:2019-04-24 22:54:43
  • 蜘蛛:Google,1次,更新时间:2019-05-11 22:02:22
  • 蜘蛛:Sogou,4次,更新时间:2019-05-09 17:50:13

参与评论