REDIRECT Invalid in beforeaction, Yii2.0.8

Source: Internet
Author: User

I got an answer on the official GitHub, and I tried it, and it really solved the problem.
Description of the previous problem:

  1. Before is the 2.0.3, then uses the composer to upgrade directly to 2.0.8, is not normal, thought is my code question, then tries again
  2. With composer Download yii-advance-2.0.8, in beforeaction jump or not, so on the forum asked

In the ordinary action there is no problem, but put in the beforeaction is not jump, equivalent to return is true, skip directly.

Do not jump code:

return $this->redirect(‘http://www.yiichina.com/‘);

Jump code:

return $this->redirect(‘http://www.yiichina.com/‘)->send();

That is, after redirect () add a Send () method on the line, I saw the YII2 code update, redirect belongs to the response class did not change too much, it should be the controller's operating mechanism in the beforeaction has changed the result.

REDIRECT Invalid in beforeaction, Yii2.0.8

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.