开发者

Why doesn't this redirect work?

Why doesn't this redirect work?

$menu = 'menu';
$item = 'item';
header('HTTP/1.1 303 See Othe开发者_开发知识库r');
header("/{$menu}/{$item}/");


Because you forgot to specify which header you're sending.

Redirect headers need to start with Location:.

header("Location: /{$menu}/{$item}/");


You need to do header("Location: /{$menu}/{$item}/");

See the example at HTTP 303 Wikipedia Page

Server response:

HTTP/1.1 303 See Other
Location: http://example.org/

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜