我用于Zend中的链接:
<?php echo baseUrl('/some/path/to/an/action');?>
这在Firefox中表现正常。该应用程序是可移植的,无需使用vhost。 例如: 这个链接
<a href="<?php echo $this->baseUrl('/admin/users'); ?>">Manage Users</a>
预期的网址应该是http://myhost/webapp_folder/public/controller/action/params但是这在IE中不起作用。我得到http:///webapp_folder/public/controller/action/params。我该如何解决这个问题呢? (什么时候微软会意识到他们一直是最有问题的浏览器?)
FF中的$ _ SERVER数组
[REDIRECT_STATUS] => 200
[HTTP_HOST] => localhost
[HTTP_USER_AGENT] => Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.12) Gecko/20101026 Firefox/3.6.12
[HTTP_ACCEPT] => text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
[HTTP_ACCEPT_LANGUAGE] => en-us,en;q=0.5
[HTTP_ACCEPT_ENCODING] => gzip,deflate
[HTTP_ACCEPT_CHARSET] => ISO-8859-1,utf-8;q=0.7,*;q=0.7
[HTTP_KEEP_ALIVE] => 115
[HTTP_CONNECTION] => keep-alive
[HTTP_REFERER] => http://localhost/industrial/public/admin/groups
[HTTP_COOKIE] => PHPSESSID=kiodpltbra87rkknebg56mcvf3
[HTTP_CACHE_CONTROL] => max-age=0
[PATH] => e:\eclipse\bin\;C:\Program Files (x86)\MiKTeX 2.8\miktex\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Common Files\Acronis\SnapAPI\;C:\Program Files (x86)\QuickTime\QTSystem\;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files (x86)\GTK2-Runtime\bin;e:\wamp\bin\php\php5.3.0\;C:\Program Files (x86)\Rational\common;
[SystemRoot] => C:\Windows
[COMSPEC] => C:\Windows\system32\cmd.exe
[PATHEXT] => .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
[WINDIR] => C:\Windows
[SERVER_SIGNATURE] =>
[SERVER_SOFTWARE] => Apache/2.2.11 (Win32) PHP/5.3.0
[SERVER_NAME] => localhost
[SERVER_ADDR] => 127.0.0.1
[SERVER_PORT] => 80
[REMOTE_ADDR] => 127.0.0.1
[DOCUMENT_ROOT] => E:/wamp/www/
[SERVER_ADMIN] => admin@localhost
[SCRIPT_FILENAME] => E:/wamp/www/industrial/public/index.php
[REMOTE_PORT] => 50447
[REDIRECT_URL] => /industrial/public/admin/users
[GATEWAY_INTERFACE] => CGI/1.1
[SERVER_PROTOCOL] => HTTP/1.1
[REQUEST_METHOD] => GET
[QUERY_STRING] =>
[REQUEST_URI] => /industrial/public/admin/users
[SCRIPT_NAME] => /industrial/public/index.php
[PHP_SELF] => /industrial/public/index.php
[REQUEST_TIME] => 1289966668
IE中的$ _ SERVER数组
[REDIRECT_STATUS] => 200]
[HTTP_ACCEPT] => */*
[HTTP_ACCEPT_LANGUAGE] => en-US
[HTTP_USER_AGENT] => Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; FunWebProducts; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.2)
[HTTP_ACCEPT_ENCODING] => gzip, deflate
[HTTP_HOST] => localhost
[HTTP_CONNECTION] => Keep-Alive
[HTTP_COOKIE] => PHPSESSID=9gdgck6s21umd2afj798aofnd0
[PATH] => e:\eclipse\bin\;C:\Program Files (x86)\MiKTeX 2.8\miktex\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Common Files\Acronis\SnapAPI\;C:\Program Files (x86)\QuickTime\QTSystem\;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files (x86)\GTK2-Runtime\bin;e:\wamp\bin\php\php5.3.0\;C:\Program Files (x86)\Rational\common;
[SystemRoot] => C:\Windows
[COMSPEC] => C:\Windows\system32\cmd.exe
[PATHEXT] => .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
[WINDIR] => C:\Windows
[SERVER_SIGNATURE] =>
[SERVER_SOFTWARE] => Apache/2.2.11 (Win32) PHP/5.3.0
[SERVER_NAME] => localhost
[SERVER_ADDR] => 127.0.0.1
[SERVER_PORT] => 80
[REMOTE_ADDR] => 127.0.0.1
[DOCUMENT_ROOT] => E:/wamp/www/
[SERVER_ADMIN] => admin@localhost
[SCRIPT_FILENAME] => E:/wamp/www/industrial/public/index.php
[REMOTE_PORT] => 50504
[REDIRECT_URL] => /industrial/public/admin/users/
[GATEWAY_INTERFACE] => CGI/1.1
[SERVER_PROTOCOL] => HTTP/1.1
[REQUEST_METHOD] => GET
[QUERY_STRING] =>
[REQUEST_URI] => /industrial/public/admin/users/
[SCRIPT_NAME] => /industrial/public/index.php
[PHP_SELF] => /industrial/public/index.php
[REQUEST_TIME] => 1289966883
奇怪的是,所有资源(css,js,images)都正确加载。这是没有正确格式的链接。
答案 0 :(得分:0)
这似乎解释了类似的问题:
答案 1 :(得分:0)
所以,
答案 2 :(得分:0)
我可能不是来自服务器。你确定它不是与Is it recommended to use the <base> html tag?相关的吗?
答案 3 :(得分:0)
您是否需要将其用于链接?
为什么不只是链接:
<a href="/admin/users">Manage Users</a>
这会强制浏览器默认附加当前的baseUrl。因此,如果您正在浏览“www.test.com”并且页面有该链接,您将转到“www.test.com/admin/users”,但如果在“www.test2.com”上使用相同的锚标记“这会导致你去”www.test2.com/admin/users“