get_home_path()
最后更新于:2021-11-26 09:12:38
get_home_path()Gets the absolute filesystem path to the root of the GeChiUI installation.
响应
(string) Full filesystem path to the root of the GeChiUI installation.
源文件
文件: gc-admin/includes/file.php
function get_home_path() {
$home = set_url_scheme( get_option( 'home' ), 'http' );
$siteurl = set_url_scheme( get_option( 'siteurl' ), 'http' );
if ( ! empty( $home ) && 0 !== strcasecmp( $home, $siteurl ) ) {
$gc_path_rel_to_home = str_ireplace( $home, '', $siteurl ); /* $siteurl - $home */
$pos = strripos( str_replace( '\', '/', $_SERVER['SCRIPT_FILENAME'] ), trailingslashit( $gc_path_rel_to_home ) );
$home_path = substr( $_SERVER['SCRIPT_FILENAME'], 0, $pos );
$home_path = trailingslashit( $home_path );
} else {
$home_path = ABSPATH;
}
return str_replace( '\', '/', $home_path );
}