gpt4 book ai didi

php - 发布http ://localhost/MyApp/MyCon/customerCheck 500 (Internal Server Error)

转载 作者:行者123 更新时间:2023-11-29 18:25:51 25 4
gpt4 key购买 nike

配置:$config['base_url'] = ' http://localhost/myApp/ ';

我想检查该电子邮件是否已存在于数据库中。我在注册表单中调用了一个函数(emailCheck())模糊输入字段,该字段在 Controller 中作为 View 给出。

AJAX 代码:

function emailCheck(){
var email = jQuery("#email").val();;
jQuery.ajax({
type: 'POST',
url: "<?php echo site_url(); ?>myCon/customerCheck",
data: {"email":email},
success:function(response){
if(response.status=="success"){
$('#test').html(response.message);
} else {
console.log(response.message)
}
}
});
}

Controller 代码:

<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/**
*
*/
class MyCon extends CI_Controller
{
public function customerCheck(){
if ($this->input->is_ajax_request()) {
$this->load->model('CustomerModel');
$mail = $this->input->post('email');
$res = $this->customerModel->customerMailCheck($mail);
if(!empty($res)) {
$data['status'] = 'success';
$data['message'] = 'Email Adress is found';
} else {
$data['status'] = 'error';
$data['message'] = 'Data not found';

}
echo json_encode($data);
exit;
} else{
redirect('somelink');
}
}
}
?>

型号代码:

<?php
class CustomerModel extends CI_Model{
function __construct()
{
parent:: __construct();
}
function customerMailCheck($mail){
$result = $this->db->get_where('privilege_customer', array('email' => $mail));
return $result->result();
}
}
?>

最佳答案

$res = $this->customerModel->customerMailCheck($mail);

如果型号名称区分大小写,那么它应该是

$res = $this->CustomerModel->customerMailCheck($mail);

关于php - 发布http ://localhost/MyApp/MyCon/customerCheck 500 (Internal Server Error),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46203652/

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