首页    >    中文手册    >   常用函数-get_userdata()

常用函数-get_userdata()

常用函数-get_userdata()

说明

返回的对象中含有用户相关信息,用户编号被传递。函数属性直接映射到数据库的wp_users表中(参见 Database Description)。

用法

<?php get_userdata(userid); ?>

示例

缺省用法

调用get_userdata(),返回用户信息,可用成员变量检索用户信息。

<?php $user_info = get_userdata(1);          

      echo('Username: ' . $user_info->user_login . "
");   
      echo('User level: ' . $user_info->user_level . "
");    
      echo('User ID: ' . $user_info->ID . "
");  
?>  

 

Username: admin
User level: 10
User ID: 1

访问Usermeta数据

<?php $user_info = get_userdata(1);    

      echo($user_info->last_name .  ", " . $user_info->first_name . "
");  
?>  

 

Blow, Joe

参数

$userid

(整数)(必需)用户编号,该用户的资料将被检索

默认值:None

users与user_meta表中的值

以下是users表中可以通过该函数访问到的值:

users

  • ID
  • user_login
  • user_pass
  • user_nicename
  • user_email
  • user_url
  • user_registered
  • user_activation_key
  • user_status
  • display_name

user_meta中可用

  • first_name
  • last_name
  • nickname
  • user_level
  • admin_color (Theme of your admin page. Default is fresh.)
  • closedpostboxes_page
  • nickname
  • primary_blog
  • rich_editing
  • source_domain

参见其他信息

Function_Reference/get_currentuserinfo, Author_Templates

分类:中文手册

* 版权声明:作者WordPress啦! 转载请注明出处。

kadıköy escortbostancı escortataşehir escortbostancı escortmaltepe escortmaltepe escortanadolu yakası escortanadolu yakası escortataşehir escortbostancı escortistanbul escortkartal escortbostancı escortkartal escortkadıköy escortpendik escortpendik escortmaltepe escortataşehir escortmaltepe escortmaltepe escortanadolu yakası escortkadıköy escortataşehir escortkadıköy escortataşehir escortümraniye escortataşehir escortkartal escortescort bayankartal escortpendik escortkartal escortgöztepe escorttuzla escortkadıköy escortkartal escortkadıköy escortmaltepe escortkartal escortataşehir escortmaltepe escortbostancı escortkartal escortpendik escortkadıköy escortataköy escortavrupa yakası escortataköy escortbakırköy escortbeylikdüzü escorttaksim escorthalkalı escortetiler escortbodrum escortmalatya escortankara escortantalya escortmersin escortantalya escortHacklinkHacklinkshellwso shellwso shellgörüntülü sohbettipobetbahis siteleri