大哥,按你说的可是修改文件名,网页打开之后出现乱码,也不会刷新,求破
<html> <head> <script type="text/javascript"> function loadXMLDoc() //ajax发送请求并显示 { var xmlhttp; if (window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else { // code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("myDiv").innerHTML=xmlhttp.responseText; } } xmlhttp.open("POST","demo.php",true); xmlhttp.send(); setTimeout("loadXMLDoc()",5000); //递归调用 } loadXMLDoc(); //先执行一次 </script> </head> <body> <button type="button" onclick="loadXMLDoc()">手动刷新</button> <div id="myDiv"></div> </body> </html><?php echo file_get_contents("demo.php"); ?>