WordPress: Function Reference/get usermeta:修订间差异

来自站长百科
跳转至: 导航、​ 搜索
(新页面: == Description == This function returns the value of a specific '''metakey''' pertaining to the user whose ID is passed via the '''userid''' parameter. == Usage == %%% <?php get_userm...)
 
无编辑摘要
第1行: 第1行:
== Description ==
== Description ==
== 描述==


This function returns the value of a specific '''metakey''' pertaining to the user whose ID is passed via the '''userid''' parameter.  
This function returns the value of a specific '''metakey''' pertaining to the user whose ID is passed via the '''userid''' parameter.  
这个函数返回了用户ID的某个'''metakey''',这个用户ID是通过'''userid'''参数传递的。


== Usage ==
== Usage ==
== 用法 ==
%%% <?php get_usermeta(userid,'metakey'); ?> %%%


%%% <?php get_usermeta(userid,'metakey'); ?> %%%
%%% <?php get_usermeta(userid,'metakey'); ?> %%%


== Example ==
== Example ==
== 例子 ==


This example returns and then displays the last name for user id 9.
This example returns and then displays the last name for user id 9.
这个例子返回并且显示了用户id9的姓。


  <?php $user_last = get_usermeta(9,'last_name'); ?>
  <?php $user_last = get_usermeta(9,'last_name'); ?>
<?php echo('User ID 9's last name: ' . $user_last . '\n'); ?>
<?php $user_last = get_usermeta(9,'last_name'); ?>
  <?php echo('User ID 9's last name: ' . $user_last . '\n'); ?>
  <?php echo('User ID 9's last name: ' . $user_last . '\n'); ?>
<div style="border:1px solid blue; width:50%; padding:10px">User ID 9's last name: Jones<br />
</div>


<div style="border:1px solid blue; width:50%; padding:10px">User ID 9's last name: Jones<br />
<div style="border:1px solid blue; width:50%; padding:10px">User ID 9's last name: Jones<br />
第18行: 第36行:


== Parameters ==
== Parameters ==
== 参数 ==
{{Parameter|$userid|integer|The ID of the user whose data should be retrieved.}}
{{Parameter|$userid|integer|The ID of the user whose data should be retrieved.}}
{{Parameter|$metakey|string|The metakey value to be returned.<ul><li><tt>'metakey'</tt> The '''meta_key''' in the [[WordPress:Database_Description#Table:_wp_usermeta|wp_usermeta table]] for the '''meta_value''' to be returned.</li></ul>}}
{{Parameter|$metakey|string|The metakey value to be returned.<ul><li><tt>'metakey'</tt> The '''meta_key''' in the [[WordPress:Database_Description#Table:_wp_usermeta|wp_usermeta table]] for the '''meta_value''' to be returned.</li></ul>}}
{{Parameter|$userid|integer|需要返回数据的用户的ID。}}
{{Parameter|$metakey|string|将要返回的metakey 值。<ul><li><tt>'metakey'</tt> [[WordPress:Database_Description#Table:_wp_usermeta|wp_usermeta table]] 中, '''meta_value''' 的'''meta_key'''将要返回。</li></ul>}}

2008年7月21日 (一) 10:03的版本

Description

描述

This function returns the value of a specific metakey pertaining to the user whose ID is passed via the userid parameter.

这个函数返回了用户ID的某个metakey,这个用户ID是通过userid参数传递的。

Usage

用法

%%% <?php get_usermeta(userid,'metakey'); ?> %%%

%%% <?php get_usermeta(userid,'metakey'); ?> %%%

Example

例子

This example returns and then displays the last name for user id 9.

这个例子返回并且显示了用户id9的姓。

<?php $user_last = get_usermeta(9,'last_name'); ?>
<?php echo('User ID 9's last name: ' . $user_last . '\n'); ?>

<?php $user_last = get_usermeta(9,'last_name'); ?>

<?php echo('User ID 9's last name: ' . $user_last . '\n'); ?>
User ID 9's last name: Jones
User ID 9's last name: Jones

Parameters

参数