Home > Backend Development > PHP Tutorial > WordPress判断用户是否登录的代码_PHP

WordPress判断用户是否登录的代码_PHP

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-01 12:17:05
Original
1035 people have browsed it

WordPress

is_user_logged_in()
说明
根据当前访问者是否登录返回布尔值true或false。

参数
该函数不接受任何参数。

用法
复制代码 代码如下:


示例
根据当前访问者的登录情况,使用is_user_logged_in()函数在主题文件中展示不同输出结果。
复制代码 代码如下:
if ( is_user_logged_in() ) {
echo 'Welcome, registered user!';
} else {
echo 'Welcome, visitor!';
}
?>


参考链接:Function Reference/is user logged in

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template