Javascript PHP致命错误:调用未定义的函数esc_url()
我在识别代码中的问题时遇到困难。我正在使用WordPress内容管理系统的代码:Javascript PHP致命错误:调用未定义的函数esc_url(),javascript,php,wordpress,Javascript,Php,Wordpress,我在识别代码中的问题时遇到困难。我正在使用WordPress内容管理系统的代码: <?php include_once 'includes/register.inc.php'; include_once 'includes/functions.php'; ?> <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>
<?php
include_once 'includes/register.inc.php';
include_once 'includes/functions.php';
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Secure Login: Registration Form</title>
<script type="text/JavaScript" src="js/sha512.js"></script>
<script type="text/JavaScript" src="js/forms.js"></script>
<link rel="stylesheet" href="styles/main.css" />
</head>
<body>
<!-- Registration form to be output if the POST variables are not
set or if the registration script caused an error. -->
<h1>Register with us</h1>
<?php
if (!empty($error_msg)) {
echo $error_msg;
}
?>
<ul>
<li>Usernames may contain only digits, upper and lower case letters and underscores</li>
<li>Emails must have a valid email format</li>
<li>Passwords must be at least 6 characters long</li>
<li>Passwords must contain
<ul>
<li>At least one upper case letter (A..Z)</li>
<li>At least one lower case letter (a..z)</li>
<li>At least one number (0..9)</li>
</ul>
</li>
<li>Your password and confirmation must match exactly</li>
</ul>
<form action="<?php echo esc_url($_SERVER['PHP_SELF']); ?>"
method="post"
name="registration_form">
Username: <input type='text'
name='username'
id='username' /><br>
Email: <input type="text" name="email" id="email" /><br>
Password: <input type="password"
name="password"
id="password"/><br>
Confirm password: <input type="password"
name="confirmpwd"
id="confirmpwd" /><br>
<input type="button"
value="Register"
onclick="return regformhash(this.form,
this.form.username,
this.form.email,
this.form.password,
this.form.confirmpwd);" />
</form>
<p>Return to the <a href="index.html">login page</a>.</p>
</body>
</html>
我找不到在这两个代码中哪里会抛出错误 您说过该函数存在于文件中
/var/www/html/register.php
但你也包括在内
include_once 'includes/register.inc.php';
这不是正确的文件名。如果您曾经使用过一次require\u
,您自己就会发现这个错误。将include
更改为require
,并获取错误消息
require_once 'includes/register.inc.php';
require_once 'includes/functions.php';
编辑
似乎我读过头了错误消息,register.php不是应该包含的文件。但此答案仍将保留在此处,不会被删除,因为错误仍然是由同一问题引起的
如果您遇到函数未定义的消息,那么它就是未定义的。这只意味着它既不存在于当前文件中,也不存在于任何包含的文件中。当然,这不是PHP核心函数。你的函数在like@VBCPP中声明的是什么文件,检查你是否包含了正确的文件来消除这个问题,如果没有,在包含的文件中回显一行,看看PHP是否真的包含了它。我想知道你是否不必添加
require_once“wp includes/formatting.PHP”代码>在您的代码上;据说,这似乎就是定义的地方…你可以清楚地看到,这就是输出错误的文件,所以这个答案是错误的。关于这个误解,你是对的。但这仍然是答案。让我们拭目以待,发现有些人不会回来告诉我们它是否有效:)
require_once 'includes/register.inc.php';
require_once 'includes/functions.php';