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

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

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

#1 User is offline   nettrinity 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 208
  • Joined: 15-March 11

Posted 26 October 2011 - 10:18 AM

if (Yii::app()->request->isAjaxRequest)   
 {        	
 	echo CJSON::encode(array( 
	     'status'=>'failure', 
     	'div'=>$this->renderPartial('_form', array('model'=>$model), true)));  
 	exit;   // can I replace exit with Yii::app()->end()? 	
  }	
 else  
 	$this->render('create',array('model'=>$model,));   
  }



Can I replace
exit
here with
Yii::app()->end()
? why?

Thank you!
It's my life!
http://giayhn.com
0

#2 User is offline   tri 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 1,651
  • Joined: 20-November 08
  • Location:Stockholm, Sweden

Posted 26 October 2011 - 11:32 AM

This is the difference (click show).

/Tommy
Don't forget to read The Definitive Guide to Yii (en) (sv) | The class reference has the details
2

#3 User is offline   nettrinity 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 208
  • Joined: 15-March 11

Posted 26 October 2011 - 01:32 PM

public function end($status=0, $exit=true)
{
    if($this->hasEventHandler('onEndRequest'))
        $this->onEndRequest(new CEvent($this));
    if($exit)
        exit($status);
}


Thanks!

It's my life!
http://giayhn.com
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users