gpt4 book ai didi

php - 通过电子邮件检查 Wordpress 用户是否存在

转载 作者:行者123 更新时间:2023-12-05 02:21:56 25 4
gpt4 key购买 nike

对于我的生活,我无法让它工作(WP Codex 的默认示例)。我用这段代码创建了一个 php 文件并将其放在我的主题文件夹中,当我在 Web 上访问该文件时,我得到一个空白页面,nada -- 我是否遗漏了什么,我是否必须将其放在其他地方?非常感谢任何帮助。

  <?php
$email = 'myemail@example.com';
$exists = email_exists($email);
if ( $exists )
echo "That E-mail is registered to user number " . $exists;
else
echo "That E-mail doesn't belong to any registered users on this site";
?>

最佳答案

简单的回答,如果那是模板页面,那么使用这个:

<?php
$email = 'myemail@example.com';
$exists = email_exists($email);
if ( $exists )
echo "That E-mail is registered to user number ";
else
echo "That E-mail doesn't belong to any registered users on this site";
?>

并确保您有正确的开始和结束 php 标签。

但如果来自模板页面以外的页面,则使用此:

<?php
require_once("../../../../wp-load.php"); //ADD THIS

$email = 'myemail@example.com';
$exists = email_exists($email);
if ( $exists )
echo "That E-mail is registered to user number ";
else
echo "That E-mail doesn't belong to any registered users on this site";
?>

根据页面位置在 require_once("../../../../wp-load.php") 中添加或删除 ../。这一定会对您有所帮助。

关于php - 通过电子邮件检查 Wordpress 用户是否存在,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31466050/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com