您好,欢迎访问一九零五行业门户网

php跳转不改变浏览器地址

php跳转不改变浏览器地址有两个方法
1、使用js实现
2、使用iframe实现
首先是js实现,代码:
function createxmlhttprequest(){ if(window.xmlhttprequest){ xmlhttpr = new xmlhttprequest(); }else if(window.activexobject){ try{ xmlhttpr = new activexobject("msxml2.xmlhttp"); }catch(e){ try{ xmlhttpr = new activexobject("microsoft.xmlhttp"); }catch(e){ } } }}function sendrequest(url){ createxmlhttprequest(); xmlhttpr.open("get",url,true); xmlhttpr.setrequestheader("content-type","text/html;charset=utf-8"); xmlhttpr.onreadystatechange = processresponse; xmlhttpr.send(null);}function processresponse(){ if(xmlhttpr.readystate ==4 && xmlhttpr.status == 200){ document.write(xmlhttpr.responsetext); }}
上面的代码就是实现页面跳转后,浏览器地址栏地址保持不变的方法。
方法二:使用iframe框架:
<iframe id="frame3d" name="frame3d" frameborder="0" width="100%" scrolling="auto" style="margin-top: -4px;" onload="this.style.height=document.body.clientheight-84" height="100%" src="http://www.5202m.com" mce_src="http://www.baidu.com"></iframe>
缺点:
存在跨域访问的问题。
总结:
推荐后台使用,前台对搜索引擎不友好,不利于优化。
推荐教程:php视频教程
以上就是php跳转不改变浏览器地址的详细内容。
其它类似信息

推荐信息