欢迎各位兄弟 发布技术文章

这里的技术是共享的

You are here

php header location self 跳转到自己 php refresh current page? 有大用

shiping1 的头像
正确答案 
 header('Location: '.$_SERVER['REQUEST_URI']);
shareimprove this answer

 
   
Shouldn't that be sanitized? – Alex Feb 21 '12 at 19:07
6 
$_SERVER['REQUEST_URI'] is a server generated variable. Only GET,POST,a and COOKIES are susceptible to user interference. (with the possible exception of headers like "Referrer") – Byron Whitlock Feb 21 '12 at 19:38
3 
Those server generated variables can be modified, so you should still consider sanitizing them. – Nicholas Pickering Aug 14 '13 at 14:18
7 
Those who argue it should be sanitized don't really understand what they are talking about. REQUEST_URI holds the URL where you currently are, so if there's any security issue with going to this URL, the harm is already done. Redirecting to where you already are has no security implication. – this.lau_ Oct 30 '14 at 17:12
2 
@RobertM. nope, it is redirecting you to the current url. As already said, the damage would already be done.– Hanoncs Oct 1 '15 at 17:59


来自 http://stackoverflow.com/questions/4221116/php-refresh-current-page


 





 


普通分类: