get_blogaddress_by_domain

函式
get_blogaddress_by_domain ( $domain, $path )
引數
  • (string) $domain
    Required:
  • (string) $path
    Required:
返回值
  • (string)
定義位置
相關方法
get_blogaddress_by_idget_blogaddress_by_nameget_admin_users_for_domainget_clean_basedomainget_blog_option
引入
-
棄用
3.7.0

get_blogaddress_by_domain:給定一個域,返回網路中相應站點的URL。這主要用於內部目的。

獲得一個完整的部落格URL,給定一個域名和一個路徑。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function get_blogaddress_by_domain( $domain, $path ) {
_deprecated_function( __FUNCTION__, '3.7.0' );
if ( is_subdomain_install() ) {
$url = "http://" . $domain.$path;
} else {
if ( $domain != $_SERVER['HTTP_HOST'] ) {
$blogname = substr( $domain, 0, strpos( $domain, '.' ) );
$url = 'http://' . substr( $domain, strpos( $domain, '.' ) + 1 ) . $path;
// We're not installing the main blog.
if ( 'www.' !== $blogname )
$url .= $blogname . '/';
} else { // Main blog.
$url = 'http://' . $domain . $path;
}
}
return sanitize_url( $url );
}
function get_blogaddress_by_domain( $domain, $path ) { _deprecated_function( __FUNCTION__, '3.7.0' ); if ( is_subdomain_install() ) { $url = "http://" . $domain.$path; } else { if ( $domain != $_SERVER['HTTP_HOST'] ) { $blogname = substr( $domain, 0, strpos( $domain, '.' ) ); $url = 'http://' . substr( $domain, strpos( $domain, '.' ) + 1 ) . $path; // We're not installing the main blog. if ( 'www.' !== $blogname ) $url .= $blogname . '/'; } else { // Main blog. $url = 'http://' . $domain . $path; } } return sanitize_url( $url ); }
function get_blogaddress_by_domain( $domain, $path ) {
	_deprecated_function( __FUNCTION__, '3.7.0' );

	if ( is_subdomain_install() ) {
		$url = "http://" . $domain.$path;
	} else {
		if ( $domain != $_SERVER['HTTP_HOST'] ) {
			$blogname = substr( $domain, 0, strpos( $domain, '.' ) );
			$url = 'http://' . substr( $domain, strpos( $domain, '.' ) + 1 ) . $path;
			// We're not installing the main blog.
			if ( 'www.' !== $blogname )
				$url .= $blogname . '/';
		} else { // Main blog.
			$url = 'http://' . $domain . $path;
		}
	}
	return sanitize_url( $url );
}

常見問題

FAQs
檢視更多 >