Yii Framework on the home page is logged in, no other pages detected login
if (Yii::app ()->user->getisguest ()) {
$blog _model=new Blog ();
$blog _model->content=$_post[' content ';
$blog _model->title=$_post[' title ';
Date_default_timezone_set (' UTC ');
$blog _model->time=date ("y-m-d h:i:s");
if ($blog _model->save ()) {
$this->redirect (site_url. ' Blog/index ');
$this->renderpartial (' success ');
}
}else{
$this->renderpartial (' Error ');
}
This is in the blog interface, to determine whether to login, login to allow posting, but always said I did not log in, has actually logged in, to find a solution
------to solve the idea----------------------
Session is automatically open, get a print look
------to solve the idea----------------------
Reference:
if (Yii::app ()->user->getisguest ()) {
$blog _model=new Blog ();
$blog _model->content=$_post[' content ';
$blog _model->title=$_post[' title ';
Date_default_timezone_set (' UTC ');
$blog _model->time=date ("y-m-d h:i:s");
if ($blog _model->save ()) {
$this->redirect (site_url. ' Blog/index ');
$this->renderpartial (' success ');
}
}else{
$this->renderpartial (' Error ');
}
This is in the blog interface, to determine whether to login, login to allow posting, but always said I did not log in, has actually logged in, to find a solution
Yii::app ()->user->getisguest This piece of code means if the user is a tourist ...