【发布时间】:2019-01-05 22:21:00
【问题描述】:
我第一次遇到这个错误,似乎无法调试它。我与此错误有关的代码如下:
<?php
session_start();
$accountUsername = $_POST["username"];
$accountEmail = $_POST["email"];
$accountPassword = $_POST["password"];
$accountPasswordConfirm = $_POST["password-confirm"];
$recaptchaResponse = $_POST["g-recaptcha-response"];
$secretRecaptcha = "XXXXXXXXXXXXXXXX";
// Send Request Of Recaptcha To Google Servers
$verifyResponse = file_get_contents('https://www.google.com/recaptcha/api/siteverify?secret='.$secretRecaptcha.'&response='.$recaptchaResponse);
$recaptchaValidation = json_decode($verifyResponse, true);
// Validate Recaptcha Response
//if ($recaptchaValidation["success"] == false) {
//echo "error:You must solve the reCAPTCHA verification";
//exit();
//}
// Validate Email Address
$accountEmaili = str_replace("@", "", $accountEmail); $accountEmaili = str_replace(".", "", $accountEmaili);
if (filter_var($accountEmail, FILTER_VALIDATE_EMAIL) && ctype_alnum($accountEmaili)) {
} else {
echo "error:You must enter a valid email address";
exit();
}
if (strlen($accountEmail) >= 5 && strlen($accountEmail) <= 400) {
} else {
echo "error:You must enter a valid email address";
exit();
}
// Validate Username
if (strlen($accountEmail) >= 8 && $accountEmail <= 14) {
} else {
echo "error:Your username must be 8-14 characters";
exit();
}
我试图改变一些东西,但没有任何效果,我也不知道这个错误代码是什么意思。谁能帮我调试一下这个问题,非常感谢。
错误:警告:输入中的意外字符:'' (ASCII=16) state=0 in /home/nodebase/public_html/WebApp/Backend/UserPortal/Register/CreateAccount.php 第 27 行
警告:输入中的意外字符:'' (ASCII=16) state=0 in /home/nodebase/public_html/WebApp/Backend/UserPortal/Register/CreateAccount.php 第 27 行
第 27 行 = if (strlen($accountEmail) >= 5 && strlen($accountEmail) <= 400) {
【问题讨论】:
-
>= 5和<= 400中发生了一些奇怪的事情,它没有出现在 cmets 中,而是作为一个框出现,但您似乎已经将其编辑了,并且不知道这是否是其中的一部分您的工作代码与否。可能是隐藏的 unicode。 -
我没听懂你的意思,你想说什么?
-
当你最初发布你的代码时,有一个字符的“框”对我来说可能是一个隐藏的 unicode 字符,但现在不显示了。我认为问题就在那里。
var_dump()你可能会看到一些东西。 -
第27行是哪一个?
-
我已经从编辑器中重新复制并粘贴了代码,没有进行任何更改,现在第 27 行在那里我编辑了帖子
标签: php error-handling