开发者

Why doesn't this redirect work?

开发者 https://www.devze.com 2023-03-04 20:38 出处:网络
Why doesn\'t this redirect work? $menu = \'menu\'; $item = \'item\'; header(\'HTTP/1.1 303 See Othe开发者_开发知识库r\');

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

精彩评论

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