'SUCCESS', 'code'=>200, 'info'=>'数据上传完毕', 'key'=>$setting['Key'], 'data'=>array( 'title'=>$_POST['task_title'], 'text'=>$_POST['task_text'], 'creator'=>$_COOKIE['studentID'], 'opentime'=>$_POST['task_opentime'], 'closetime'=>$_POST['task_closetime'], 'open'=>'TRUE', ) ); //请求参数(数组) $jsonStr = json_encode($arr); //转换为json格式 $result = http_post_json($url, $jsonStr); $result = json_decode($result,true); // 返回结果 if ($result['output'] == "SUCCESS") { header('location: /admin/class_book.php'); } elseif ($result['output'] == "MYSQL_ERROR") { echo << alert( "数据库错误,请联系管理员" ) window.history.go(-1); EOF; } else { echo << alert( "密钥错误" ) window.history.go(-1); EOF; } } else { echo << alert( "你没有权限" ) window.history.go(-1); EOF; }