更新
This commit is contained in:
@@ -15,7 +15,7 @@ class Api {
|
||||
|
||||
public function __construct() {
|
||||
header("Access-Control-Allow-Origin: *");
|
||||
header("Access-Control-Allow-Methods: GET, POST, PUT, DELETE");
|
||||
header("Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS");
|
||||
header("Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept, Authorization");
|
||||
$header = getallheaders();
|
||||
$this->data = array('code' => 0, 'msg' => '', 'time' => time(), 'data' => '');
|
||||
@@ -24,12 +24,12 @@ class Api {
|
||||
if (!$isCheck && 'api/index/gettoken' !== strtolower($url)) {
|
||||
$this->data['code'] = '301';
|
||||
$this->data['data'] = '非法请求!';
|
||||
echo json($this->data);
|
||||
echo json_encode($this->data);
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
protected function checkToken($header){return true;
|
||||
protected function checkToken($header){
|
||||
if (isset($header['Authorization']) && $header['Authorization']) {
|
||||
$token = authcode($header['Authorization']);
|
||||
list($appid, $appsecret, $currentTime) = explode('|', $token);
|
||||
|
||||
Reference in New Issue
Block a user