Note: Add gray background, about the value of
Ajax , and JS judgment
1 post-Login controller processing: Determine whether to log in and transmit user information
classIndexcontrollerextendsHomebasecontroller {//Login Publicfunctionindex () {$id=i ("Get.id"); $users _model=m ("Users"); $user=$users _model->where (Array("id" =$id)),find (); if(Empty($user)){ $this->error ("Look no man!") "); } $this->assign ($user); $this->display (": Index"); } functionIs_login () {if(Sp_is_user_login ()) { $this,AjaxReturn (array("status" =>1, "user" = Sp_get_current_user ())); }Else{ $this-AjaxReturn (Array("Status" =>0, "info" = "This user is not logged in!") ")); } }
。。。。。。
2 Landing and not logged-in display of the home navigation bar before and after landing
<DivID= "Main-menu-user">
<Divclass= ' Useroutuser '><ulclass= "Nav navbar-nav navbar-right"><Li><ahref= "{: U (' User/register/index ')}"Data-toggle= "Dropdown">Registered
a>
Li>
ul><ulclass= "Nav navbar-nav navbar-right"><Li><ahref= "{: U (' User/login/index ')}"Data-toggle= "Dropdown">Landing
a>
Li>
ul><ulclass= "Nav navbar-nav navbar-right"style= "margin-top:10px"><Li><imgsrc= "__tmpl__/public/img/headicon.png"class= "Headicon"/>
Li>
ul>
Div>
<Divclass= "Userlogin user"><ulclass= "Nav navbar-nav navbar-right"><Li><ahref= "{: U (' user/index/logout ')}"Data-toggle= "Dropdown">Exit
a>
Li>
ul><ulclass= "Nav navbar-nav navbar-right"><Li><ahref= "{: U (' User/center/index ')}"Data-toggle= "Dropdown"class= "User-nicename">
a >
li>
ul><ul class = "nav navbar-nav navbar-right" style= "margin-top:10px"> <Li ><img src= "" Class = "Headicon"/>
li>
ul >
div>
div>
3 after landing, JS to the box operation
The above describes the landing before and after the navigation bar processing 2015-12-12, including the content of Ajax, I hope that the PHP tutorial interested in a friend helpful.