Homepage sometimes can't load style
This post was last edited by yang131261 on 2014-08-15 18:17:14
Do a site, the home page has a cache sometimes open when the path of the style is such an IP address/CSS/INDEX.CSS home style disorderly This site started with ip:8080 access to bind the domain name after the domain access but sometimes the style or the loaded IP's clear cache after the style of the path to change the domain name /CSS/INDEX.CSS home style is normal. The cache for the home page is in the file cache
The path to the style is based on the function obtained by the
function Get_http ()
{
return isset ($_server[' https ") && strtolower ($_server[' https"])! = ' off '? ' https://': '/HTTP ';
}
function Get_domain ()
{
$protocol = Get_http ();
if (Isset ($_server[' http_x_forwarded_host ')) {
$host = $_server[' http_x_forwarded_host ');
} elseif (Isset ($_server[' http_host ')) {
$host = $_server[' http_host ');
} else {
if (Isset ($_server[' Server_port ')) {
$port = ': '. $_server[' Server_port '];
if (': "= = $port && '/http ' = = $protocol | | ': 443 ' = = $port && ' https://' = = $protocol) {
$port = ";
}
} else {
$port = ";
}
if (Isset ($_server[' server_name ')) {
$host = $_server[' server_name '). $port;
} elseif (Isset ($_server[' server_addr ')) {
$host = $_server[' server_addr '). $port;
}
}
Return $protocol. $host;
}
------Solution--------------------
Will your website switch between HTTP and HTTPS?
Only need to generate a full URL if a switchover occurs
When you are 12 lines, what is the code for the processing port to be executed? ($_server[' http_host ') is always present.
Processing ports (port) and processing HOST are parallel and should not be placed in the Else branch