$this->redirect() is not working

hi all

I run code:

$this->redirect('/admin/articles');

show error:

Cannot modify header information - headers already sent by (output started

at

common/components/helpers/UltilityHelper.php:2)

(common/lib/Yii/web/CHttpRequest.php:789)

Stack trace:

#0

controllers/ArticlesController.php(101):

ArticlesController->redirect()

however I comment //$this->redirect(’/admin/articles’);

It don’t show error

Thanks!

the error is self-explanatory: you cannot do redirect because some html data was already sent. Redirect is done using http headers and they can be sent only at the beginning of comunication (before any page data is sent). This is PHP way of handling http response headers.

in other ways - do not try to redirect after you called render() or renderPartial() which sends output. if you sure you do not call render/renderPartial - check if there is no "debug" echoes or BOM headers in your php files…

try this

[font=Arial][size=2]


 Yii::app()->controller->redirect(array('/myController/myAction', 'param1'=>'uno'));

[/size][/font]