简体   繁体   English

Internet Explorer使用PHP的怪异行为

[英]Internet Explorer's Weird Behavior With PHP

I have a php code list.php working differently on Internet Explorer 9, 10, 11 and chrome. 我有一个PHP代码list.php在Internet Explorer 9、10、11和chrome上以不同的方式工作。

I'm listing pagination using <a href=$_SERVER[PHP_SELF]?no=$next_list> . 我正在使用<a href=$_SERVER[PHP_SELF]?no=$next_list>列出分页。 In Chrome and IE 11, this code works fine, which means when I click the link I am directed to mydomainname.com/list.php?no=10 . 在Chrome和IE 11中,此代码可以正常工作,这意味着当我单击链接时,我将定向到mydomainname.com/list.php?no=10

But in IE 9 and 10, I am directed to list.php?no=10 and am encountered by 'page not found' error. 但是在IE 9和10中,我被定向到list.php?no=10并遇到“找不到页面”错误。 In other words, I am directed to a solid 'file name' instead of 'domain address + file name'. 换句话说,我被定向到一个固定的“文件名”,而不是“域名+文件名”。

Another behavior I noticed in IE 9 and 10 before I click the pagination link is that the address reads mydomainname.com//list.php . 在单击分页链接之前,我在IE 9和10中注意到的另一行为是该地址为mydomainname.com//list.php

I've included html5shiv.js and respond.js for IE performances. 我已经包括html5shiv.js和response.js来提高IE的性能。

Is it something like $_SERVER or PHP_SELF not configured properly for old IE? 是否为旧IE未正确配置$ _SERVER或PHP_SELF之类的东西? I would greatly appreciate any help. 我将不胜感激任何帮助。 Thanks! 谢谢!

Try this: 尝试这个:

<a href=/$_SERVER[PHP_SELF]?no=$next_list>

note the "/" - this will bring you always back to root 注意“ /”-这将使您始终回到根

Is that what you mean? 你是这个意思吗?

<?php

$next_list = 12;

?>
<body>
    <?php echo "<a href=$_SERVER[PHP_SELF]?no=$next_list>test</a>"; ?>
</body>

I couldn't reproduce the issue with the above test code, maybe you have a link to provide ? 我无法通过上述测试代码重现该问题,也许您有提供的链接?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM