fastadmin开发手册

用户信息


在CMS内容管理系统前台模板标签中如需要获取当前登录用户的信息,可以通过以下信息进行获取。

判断用户是否登录


在用渲染用户信息前,需要先判断用户是否登录,否则在获取时可能出错,可采用以下方式进行判断,如:

``html

{if $user}
欢迎你!{$user.nickname|htmlentities}
{else/}
你好,请登录
{/if}
``


获取用户信息


可使用{$user.字段名}来获取用户的信息,如:

``html

{$user.id|htmlentities}

{$user.nickname|htmlentities}

{$user.avatar|cdnurl|htmlentities}

{$user.字段名|htmlentities}
``


用户信息字段


| 字段名 | 描述 |
| --- | --- |
| nickname | 用户昵称 |
| id | 用户ID |
| level | 用户等级 |
| score | 用户积分 |
| mobile | 用户手机号 |
| ... | ... |

字段名可以从fa_user表中的字段结构获取。

温馨提示:建议在变量输出时都加上htmlentities函数处理后再输出


10 Screens$8,029

I will design rough sketches for upto 5 Screens of your website/Mobile app.

3 Days Delivery 1 Revision
  • Source File
  • Commercial Use
  • Interactive Mockup
  • 10 Pages

20 Screens$16,029

I will design rough sketches for upto 5 Screens of your website/Mobile app.

3 Days Delivery
  • Source File
  • Commercial Use
  • Interactive Mockup
  • 10 Pages

30 Screens$24,029

I will design rough sketches for upto 5 Screens of your website/Mobile app.

3 Days Delivery
  • Source File
  • Commercial Use
  • Interactive Mockup
  • 10 Pages
0.274336s