PHP-错误ASCII=16状态=0输入中的意外字符
我第一次遇到这个错误,似乎无法调试它。我的代码与此错误有关,如下所示:PHP-错误ASCII=16状态=0输入中的意外字符,php,error-handling,Php,Error Handling,我第一次遇到这个错误,似乎无法调试它。我的代码与此错误有关,如下所示: <?php session_start(); $accountUsername = $_POST["username"]; $accountEmail = $_POST["email"]; $accountPassword = $_POST["password"]; $accountPasswordConfirm = $_POST["password-confirm"]; $recaptchaResponse = $_
<?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();
}
如评论中所述,代码中存在隐藏的(unicode)字符,这可能是由主机的编辑器造成的
通过复制/粘贴我在评论中提到的以下内容,将为您解决此问题
if (strlen($accountEmail) >= 8 && $accountEmail <= 14) {
如果(strlen($accountEmail)>=8&&$accountEmail
和在=5
中发生了一些奇怪的事情,对于我不理解你,你是什么意思?当你最初发布代码时,有一种“盒子”对于一个对我来说可能是隐藏的unicode字符的字符,但现在没有显示。我想问题就在那里。var_dump()
你可能会看到一些东西。第27行是哪一行?我已经从编辑器中重新复制并粘贴了代码,没有做任何更改,第27行在那里了吗?我编辑了这篇文章