开发者

Whats wrong with this header code?

$return_url = $_SERVER['REQUEST_URI'];
header("Location: /logout?msg=You must login to view that page&c=2&path=$return_url");

For some reason its taking me to http://my.domain/login?msg=You%20must%20logi开发者_如何学Pythonn%20to%20view%20that%20page&c=2

when it should take me to

to http://my.domain/login?msg=You%20must%20login%20to%20view%20that%20page&c=2&path=/blogs/write

if i echo $return_url it returns the right path...

So i'm not sure whats up. Help?


You need to use the urlencode function like so:

header("Location: /logout?msg=".urlencode("You must login to view that page")."&c=2&path=".urlencode($return_url);

In addition, it seems like your logout page is also redirecting to /login. View the sequence of requests which occur using an HTTP Proxy such as Fiddler.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜