发布ajax curl php时为空值

发布ajax curl php时为空值,php,ajax,codeigniter,curl,php-curl,Php,Ajax,Codeigniter,Curl,Php Curl,为什么在codeigniter中总是使用CURL方法从Ajax获取空值数据 这是我的错误: 发生数据库错误错误,错误号:23000/515[Microsoft][ODBC SQL Server的驱动程序11][SQL Server]无法将值NULL插入到 列'noreg',表'DBRS_MARGONO.dbo.VKLAIM_VERIF';列不存在 允许空值。插入失败。插入“VKLAIM_VERIF”(“noreg”), “用户id”、“已验证”、“级别验证”、“catatan”)值(NULL、N

为什么在codeigniter中总是使用CURL方法从Ajax获取空值数据

这是我的错误:

发生数据库错误错误,错误号:23000/515[Microsoft][ODBC SQL Server的驱动程序11][SQL Server]无法将值NULL插入到 列'noreg',表'DBRS_MARGONO.dbo.VKLAIM_VERIF';列不存在 允许空值。插入失败。插入“VKLAIM_VERIF”(“noreg”), “用户id”、“已验证”、“级别验证”、“catatan”)值(NULL、NULL、, NULL,0,“”)文件名: C:/xampp/htdocs/ws/system/database/DB_driver.php行号:691

以下是调用ajax时要打印的控制器:

$post = array();
        $post['noreg'] = $this->input->post('noreg');
        $post['user'] = $this->input->post('user');
        $post['status'] = $this->input->post('verified');

        $url = 'http://localhost/ws/rsms/verifupdatesimpanstatus';

        $ch = curl_init();

        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_POST, 1);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_HTTPHEADER, array(
            "Content-Type: application/json; charset=utf-8",
            "X-API-Key: " . $aksesws['X-API-Key'],
            "IDAPP: " . $aksesws['IDAPP'])
        );

        $de = curl_exec($ch);
        $d = json_decode($de, true);
        curl_close($ch);
        echo $de;
但是当我测试post数据时,
$post
被发送,我认为CURL-post方法存在问题。我一直在寻找解决方案,但我不知道错误在哪里。当我使用Postman中的POST方法x-www-form-urlencoded

以下是我的ajax代码:

function updateStatusVerif(noreg,user,verified) {
        $.post("<?php echo base_url();?>superuser/pasien/updateStatusVerif",
        {
            noreg : noreg,
            user : user,
            verified : verified
        },
        function(data){
            $('#btnverif').html(data);
        });
    }
函数updateStatusVerif(noreg,用户,已验证){
$.post(“超级用户/pasien/updateStatusVerif”,
{
noreg:noreg,
用户:用户,,
已验证:已验证
},
功能(数据){
$('#btnverif').html(数据);
});
}

我将返回数据值从web服务发送到#btnverif元素。

在@Arthur的帮助后,我将
json_encode
添加到
curl_setopt($ch,CURLOPT_POSTFIELDS,$post)谢谢你#解决了

在你给$post添加值后,做一个json#U编码并尝试通过邮递员发送,看看会发生什么。你的意思是用raw代替邮递员中的x-www-form-urlencoded吗?所以我用json格式将数据发送到web服务?@Arthur wow bingooo,很有效,非常感谢,先生