简体   繁体   中英

Internet Explorer's Weird Behavior With PHP

I have a php code list.php working differently on Internet Explorer 9, 10, 11 and chrome.

I'm listing pagination using <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 .

But in IE 9 and 10, I am directed to list.php?no=10 and am encountered by 'page not found' error. 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 .

I've included html5shiv.js and respond.js for IE performances.

Is it something like $_SERVER or PHP_SELF not configured properly for old IE? 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 ?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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