开发者

Redirect with Mason 1.0

I am using Mason 1.0 and want to redirect the page to another URL.

Is there any way to redirect?

Alternatively...

I have written following code in dbhandler which is giving error, stating that $r is undefined. Can you please help.

$r->method('GET');
$r->headers_in->unset('Content-length');
$r->content_type('text/html');
开发者_高级运维$r->header_out('Location' => $newPageURL);
$m->abort(301);

I cannot use $m->redirect as it is not avalible to me.

I am referring to this link http://www.masonhq.com/htmlmason/wiki/FAQ:HTTPAndHTML on the section "How do I do an external redirect?"


$r->status(302);
$r->headers_out()->add("Location", "http://google.com");
return 302;


Looks like $m->clear_buffer is missing before your first call.

It's required so it wipes out any response generated before you reach your redirection.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜