5) { // 用户已经申请过了,返回状态码1和提示信息 $response = array('status' => 1, 'msg' => '您申请的订单已超限,请联系客服'); echo json_encode($response); } else { // 判断$channel变量是否为空,如果为空则将其赋值为null if(empty($channel)){ $channel = 0; } $data_insert = mysqli_query($con, "insert into oder(goods,name,uid,phone,sf,city,xian,dizhi,oderid,time,price,channel) values('$goods','$name','$uid','$phone','$sf','$city','$xian','$dizhi','$oderid','$time','$price','$channel')"); if ($data_insert) { // 申请成功,返回状态码0和提示信息 $response = array('status' => 0, 'msg' => '申请成功'); echo json_encode($response); // 判断$status是否为0,如果是则执行$sendSms()函数 if ($response['status'] == 0) { sendSms($appId, $appKey, $phoneNumber, $templateId, $smsSign); } } else { // 信息不全,返回状态码-1和提示信息 $response = array('status' => -1, 'msg' => '信息不全,请输入全部信息'); echo json_encode($response); // echo "Error updating record: " . $con->error; } } }