Common Yii questions

Comparing #18 with #19

Revision #19 was created by dckurushin dckurushin on Oct 26, 2011, 6:31:36 PM.

what's the difference between exit and Yii::app()->end()

Content

[...]
CHtml::beginForm('', 'post',array('enctype'=>'multipart/form-data'));
//the file field
CHtml::fileField('data', '');
```

<hr/>
 
 
### what's the difference between exit and Yii::app()->end()
 
 
#### Answer:
 
Both terminates the application. But end method calls onEndRequest event before doing the exit...
 
In this case as in a lot of others the source code explains itself very-well
 
 
 
 
```php 
public function end($status=0, $exit=true)
 
{
 
    if($this->hasEventHandler('onEndRequest'))
 
        $this->onEndRequest(new CEvent($this));
 
    if($exit)
 
        exit($status);
 
}
 
```