样式的路径采用的是这个函数获得的
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 (':80' == $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;}
回复讨论(解决方案) ip地址/css/index.css
这里不是应该ip地址 :8080/css/index.css
ip地址/css/index.css
这里不是应该ip地址 :8080/css/index.css
有道理
ip地址/css/index.css
这里不是应该ip地址 :8080/css/index.css
本来应该显示ip:8080 的但是获得是ip 没有带端口,而且现在已经绑定域名了 偶尔还是获得ip 不带端口号 但是清除一下程序的缓存就好了,我想着是不是偶尔服务服务器不稳定 造成获得不了域名呢 那什?情?下?使用ip?
那什?情?下?使用ip?
这个不确定,网站的首页有10分钟的缓存,会在10分钟过后重新缓存,有时候访问访问着样式就乱了,所以才猜有可能是服务器不稳当 你的网站会是在 http 和 https 间切换吗?
只有在发生切换时才需要产生完整的 url
你 12 行起的,处理端口的代码在什么情况下会执行呢?($_server['http_host'] 总是存在的)
处理端口(port)和处理 host 是平行的,不应该放在 else 分支中
谢谢版主热心回答
