gpt4 book ai didi

javascript - 为什么参数读取为true?

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

我尝试调用变量 $hetest 但它总是返回 true,但是当我调用函数时我添加 false 作为参数

 //function which i call in javascript file
create_new_user_send_sms(user_Mobile_Number,false)
.fail(error => console.error(error))
.done(response => {})
//the ajax call of the function i created
function create_new_user_send_sms(mobile_number,hestatus){
return jQuery.ajax({
type : "POST",
url: ajax_object.ajax_url,
data: {
action : 'create_user_send_sms',
mobile_number : mobile_number,
auto_Login_status : "true",
he : hestatus,
},

success: function (data) {
},

error : function(error){
console.log("error:" + error);
}
});
}

//the code in the php function create_user_send_sms
$mobile_number = $_POST['mobile_number'];
$auto_Login_status = $_POST['auto_Login_status'];
$hetest = $_POST['he'];
$password = wp_generate_password( 4, false, false );

最佳答案

尝试使用filter_validation函数来处理 bool 后变量:

$hetest = filter_var($_POST['he'], FILTER_VALIDATE_BOOLEAN);

关于javascript - 为什么参数读取为true?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60623456/

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