PHP文件结果的JSON是代码,不要发短信

时间:2015-08-27 02:51:47

标签: php jquery json

我在文件update_customer.php中有代码PHP来保存客户信息

    <?php
date_default_timezone_set('Asia/Ho_Chi_Minh');

$response = array( 'status' => 0, 'message' => '', 'typeinsurance' => '', 'thoigianmua' => 0 );

if (empty($_GET) && !empty($_POST) && count($_POST) == 7 && isset($_POST['fullname']) && isset($_POST['email']) && 
    isset($_POST['address']) && isset($_POST['phone']) && isset($_POST['cost']) && isset($_POST['typeinsurance']) && 
    isset($_POST['typepay']))
{
    require_once ('./../include/database.php');
    $database = new Database();

    $time = time();

    $_POST['thoigianmua'] = $time;

    if ($database->insert('customer', $_POST)){
        $response['status'] = 1;
        $response['typeinsurance'] = $_POST['typeinsurance'];
        $response['thoigianmua'] = $time;
    }
}

echo json_encode($response);

并编写JQUERY来发送数据,但我的JSON获取

Object {status: 1, message: "", typeinsurance: "<?php echo $_POST['typeinsurance']; ?>", thoigianmua: 1440642246}

请帮助我,提前谢谢

0 个答案:

没有答案