In form validating,I find such codes
if(isset($_POST['ajax']) && $_POST['ajax']==='login-form')
{
echo CActiveForm::validate($model);
Yii::app()->end();
}
The manual says that the end() method will terminate the application. Why to terminate the app? The following codes will not execute?
Each Yii application system contains a single application object which is created in the entry script and is globally accessible through the expression \Yii::$app . Info: Depending on the context, when we say "an application", it can mean either an application object or an application system.
You can send HTTP headers by manipulating the header collection in the response component. For example, $headers = Yii::$app->response->headers; // add a Pragma header. Existing Pragma headers will NOT be overwritten.
Yes, it's an Ajax request and the code is supposed to return the validation results and then stop code execution. It's the same idea as the Php die function, but allows Yii to run onApplicationEnd cleanup code (if any)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With