KItis KItis - 2 months ago 6
PHP Question

What is the difference between $this->render() and $this->redirect()

I am new to the Yii framework and I would like to know the difference between

$this->render()
and
$this->redirect()
.

Both can be used to retrieve a given page.

Answer

It looks like they do quite different things:

  • ->redirect($url, ...)
    redirect does a HTTP page redirect. Does not directly render a page.

  • ->render($view, ...)
    render outputs the named view. Does not terminate the current PHP request.

Comments