Access to login information
Yii::app ()->user->name, transfer the login session information
$LoginForm->login () is called at logon to get the login user name
Pre-and post-session prefix settings
Note and the foreground distinguish, need to set: Inside the modules module inside the module.php Yii::app ()->setcomponents (Array (' user ' = = Array (' Statekeyprefix ' = ' admin '),);
Session use
Storage: Yii::app ()->session[' logintime '] = time (); Call: Yii::app ()->session[' Logintime ']
Clear: Yii::app ()->session->clear (); Yii::app ()->session->destroy (); Exit Login: Yii::app ()->user->logout ();
Redirect Jump method use
If under current controller: $this->redirect (Array (' index '))//jump to the current controller index method to access other controller methods: $this->redirect (Array (' Controller/method ')
The CreateURL method uses
Use $this->createurl (' Controller/method ', get parameter) in the view, $this->createurl (' Article/index ', Array (' aid ' =>3));
Other
?> Get the user name after login
?> Get Client IP
?> getting a server environment
?> Get PHP Version
?> Get Server IP
?> Database client Information
?> remaining space
Some usages in thinkphp
Server information $con = mysql_connect (c (' Db_host '), C (' Db_user '), C (' db_pwd ')); $info = Array ( ' operating system ' = Php_os, ' running environment ' = ' $_server[' server_software '), ' PHP run as ' = Php_sapi_ Name (), ' mysql version ' = Mysql_get_server_info (), ' product name ' = = king_appname, ' product serial # ' and ' King_ ' BUILD, ' upload attachments limit ' = Ini_get (' upload_max_filesize '), ' execution time limit ' = Ini_get (' Max_execution_time '). "Seconds", ' remaining space ' = Round ((@disk_free_space (".")/(1024 * 1024 *1024)), 2). ' GB ', ); Mysql_close ($con); $this->assign (' Server_info ', $info);
YII 1.0 (7) Login Information Session use