[英]quoted javascript and JSON to PHP
這個javascript:
"jform[username]": {
required: true,
minlength:5,
maxlength:15,
remote: "modules/mod_easiness_register/libs/elements/db_checker.php"
},
必須將它的值傳遞給這個PHP腳本:
if (isset($_REQUEST['jform[username]'])) {
$username = $_REQUEST['jform[username]'];
$username = $mysqli->real_escape_string($username);
$check_for_username = $mysqli->query("SELECT username FROM $users WHERE username='$username'");
if (mysqli_num_rows($check_for_username)) {
echo "false";
} else {
echo "true";
}
}
“jform [用戶名]”周圍的“”(引號)是麻煩制造者,但我必須使用這些引號使括號[]工作(我也需要這些括號)。 我認為JSON無法解決這個問題。 你知道這個方法嗎? 我希望你能理解這個問題。 非常感謝您的幫助。
我認為在你的PHP腳本中你應該檢查$_REQUEST['jform']['username']
,這將解決你的問題。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.