WordPress: Function Reference/is user logged in:修订间差异

来自站长百科
跳转至: 导航、​ 搜索
(新页面: == Description == Returns boolean <tt>true</tt> or <tt>false</tt> depending on whether the current visitor is logged in. == Usage == %%% <?php if (is_user_logged_in()){ ... } ?> %%% =...)
 
无编辑摘要
第1行: 第1行:
== Description ==
== Description ==
== 描述==


Returns boolean <tt>true</tt> or <tt>false</tt> depending on whether the current visitor is logged in.
Returns boolean <tt>true</tt> or <tt>false</tt> depending on whether the current visitor is logged in.
根据当前的访客有没有登录,返回boolean <tt>正确的</tt>或者<tt>错误的/tt>。


== Usage ==
== Usage ==
== 用法 ==
%%% <?php if (is_user_logged_in()){ ... } ?> %%%


%%% <?php if (is_user_logged_in()){ ... } ?> %%%
%%% <?php if (is_user_logged_in()){ ... } ?> %%%


== Examples ==
== Examples ==
== 例子 ==


Use <tt>is_user_logged_in()</tt> in your theme files to display different output depending on whether the user is logged in.
Use <tt>is_user_logged_in()</tt> in your theme files to display different output depending on whether the user is logged in.
在你的主题文件中使用<tt>is_user_logged_in()</tt>,根据用户是否已经登录,显示不同的结果。


  <?php  if (is_user_logged_in()){
  <?php  if (is_user_logged_in()){
            echo "Welcome, registered user!";
          }
          else {
            echo "Welcome, visitor!";
            };
?>
<?php  if (is_user_logged_in()){
             echo "Welcome, registered user!";
             echo "Welcome, registered user!";
           }
           }
第20行: 第41行:


== Parameters ==
== Parameters ==
== 参数 ==


This function does not accept any parameters.
This function does not accept any parameters.
 
这个函数不接受任何参数。
[[WordPress:Category:Functions]]
[[WordPress:Category:Functions]]
[[WordPress:Category:New page created]]
[[WordPress:Category:New page created]]
[[WordPress:Category:Functions|类别:函数]]
[[WordPress:Category:New page created|类别:没有创建新的网页]]


== Further Reading ==
== Further Reading ==
== 深入阅读 ==


* [[WordPress:Function_Reference]]
* [[WordPress:Function_Reference]]
* [[WordPress:Function_Reference|Function_Reference]]

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

Description

描述

Returns boolean true or false depending on whether the current visitor is logged in.

根据当前的访客有没有登录,返回boolean 正确的或者错误的/tt>。

Usage

用法

%%% <?php if (is_user_logged_in()){ ... } ?> %%%

%%% <?php if (is_user_logged_in()){ ... } ?> %%%

Examples

例子

Use is_user_logged_in() in your theme files to display different output depending on whether the user is logged in.

在你的主题文件中使用is_user_logged_in(),根据用户是否已经登录,显示不同的结果。

<?php  if (is_user_logged_in()){
           echo "Welcome, registered user!";
         }
         else {
           echo "Welcome, visitor!";
           };
?>


<?php if (is_user_logged_in()){

           echo "Welcome, registered user!";
         }
         else {
           echo "Welcome, visitor!";
           };
?>

Parameters

参数

This function does not accept any parameters. 这个函数不接受任何参数。 WordPress:Category:Functions WordPress:Category:New page created

类别:函数 类别:没有创建新的网页

Further Reading

深入阅读