如何重定向没有标题功能的页面 [英] How to redirect a page without header function

查看:54
本文介绍了如何重定向没有标题功能的页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在php中重定向页面。但我不想使用header()函数,因为它会导致很多错误。我想使用无错误的方法。

请指导我,我该怎么做?

解决方案

您可以使用PHP输出PHP:



  echo  ' <脚本> window.location的= http://abc.com < /脚本>'; 
/>





它会将您的页面重定向到http://abc.com。


你可以在Apache上打开mod_rewrite并将URL重写到你希望它被重定向的页面。看看这里开始: mod_rewrite [ ^ ]



此过程称为URL重写。希望这会有所帮助,因为我无法想到任何其他方法来重定向页面:)。





干杯。


printf(< script> location.href ='errorpage html的'< /脚本>中);

I want to redirect a page in php. But I don't want to use header() function, because it causes so many errors. I want to use an error free method.
Please guide me, how can i do that?

解决方案

You can use JavaScript outputs by you PHP:

    echo '<script>window.location="http://abc.com"</script>';
/>



It will redirect your page to http://abc.com.


you can turn on mod_rewrite on Apache and rewrite the URL to the page you want it to be redirected. Have a look here to begin : mod_rewrite[^]

This process is called URL rewriting. Hope this helps, because I cannot think of any other approach to redirect the page :) .


Cheers.


printf("<script>location.href='errorpage.html'</script>");


这篇关于如何重定向没有标题功能的页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆