* Process options method.

This commit is contained in:
zhujinyong
2021-09-01 09:02:37 +08:00
parent 664e290f97
commit 4a0c1241bd
2 changed files with 10 additions and 2 deletions
+9 -2
View File
@@ -174,14 +174,21 @@ class baseEntry
* 发送请求的响应数据
* Send response data
*
* @param int $code
* @param mixed $data
* @access public
* @return void
*/
public function send($code, $data)
public function send($code, $data = '')
{
header("Access-Control-Allow-Origin: *");
header("Access-Control-Allow-Credentials: true");
header("Access-Control-Allow-Headers: Origin,X-Requested-With,Content-Type,Accept,Authorization,Token,Referer,User-Agent");
header('Access-Control-Allow-Methods: GET,POST,PUT,DELETE,OPTIONS,PATCH');
header("Content-type: application/json");
header("HTTP/1.1 {$this->statusCode[$code]}");
echo json_encode($data);
if($data) echo json_encode($data);
exit;
}