show logout button along with the name of user after successfull login

后端 未结 2 1874
忘了有多久
忘了有多久 2021-01-29 09:10

I am a yiibie, and i am stuck at a point. I have three roles in my project. 1.Admin. 2.Owner 3. Authenticated User. I have a header and a footer widget.In header widget which is

相关标签:
2条回答
  • 2021-01-29 09:20

    Is easy after login you can see the username otherwise you see nothings

    <?php  
       if (!Yii::app()->user->isGuest) {
        echo Yii::app()->user->name;
       }
     ?>
    
    0 讨论(0)
  • 2021-01-29 09:21

    Read the documentation please.

    This will be helpful:

    http://www.yiiframework.com/doc/api/1.1/CWebUser#isGuest-detail

    Here example: http://pastebin.com/r0XpkPNZ

    0 讨论(0)
提交回复
热议问题