$studentID, 'password'=>$password, ); //请求参数(数组) $jsonStr = json_encode($arr); //转换为json格式 $result = http_post_json($url, $jsonStr); $result = json_decode($result,true); // 返回结果 if ($result['output'] == "SUCCESS") { // 赋予COOKIE setcookie( 'studentID' , $studentID , time()+2678400 , '/' , ''); // 返回 if (empty($callback)) { header('location: /index.php'); } else { header('location: '.$callback); } } elseif ($result['output'] == "PASSWORD_DENY") { echo << alert( "密码错误" ) window.history.go(-1); EOF; } else { echo << alert( "未知错误" ) window.history.go(-1); EOF; } } else { echo << alert( "不要空账户或者密码" ) window.history.go(-1); EOF; }