Difference between #18 and #19 of
Common Yii questions

Revision #19 has been created by dckurushin on Oct 26, 2011, 6:31:36 PM with the memo:

what's the difference between exit and Yii::app()->end()
« previous (#18) next (#20) »

Changes

Title unchanged

Common Yii questions

Category unchanged

FAQs

Yii version unchanged

Tags unchanged

yii, common, questions, beginners

Content changed

[...]
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);
 
}
 
```
 
 
 
14 0
23 followers
Viewed: 59 632 times
Version: 1.1
Category: FAQs
Written by: dckurushin
Last updated by: migajek
Created on: Oct 17, 2011
Last updated: 13 years ago
Update Article

Revisions

View all history