合规国际互联网加速 OSASE为企业客户提供高速稳定SD-WAN国际加速解决方案。 广告
> 验证接口路由和设置跨域请求 ` ~~~ <?php // +---------------------------------------------------------------------- // | Created by PHPstorm: JRKAdmin框架 [ JRKAdmin ] // +---------------------------------------------------------------------- // | Copyright (c) 2019~2022 [LuckyHHY] All rights reserved. // +---------------------------------------------------------------------- // | SiteUrl: http://www.luckyhhy.cn // +---------------------------------------------------------------------- // | Author: LuckyHhy <jackhhy520@qq.com> // +---------------------------------------------------------------------- // | Date: 2020/3/12-11:46 // +---------------------------------------------------------------------- // | Description: // +---------------------------------------------------------------------- namespace app\api\check; use think\Controller; /** * Class ApiCheck * @package app\common\controller */ class ApiCheck extends Controller { protected function initialize() { parent::initialize(); // TODO: Change the autogenerated stub //设置跨域请求 header('content-type:application/json;charset=utf8'); header('Access-Control-Allow-Origin:*'); header('Access-Control-Allow-Methods:GET,POST,PATCH,PUT,DELETE'); header('Authorization,Content-Type,If-Match,If-Modified-Since,If-None-Match,If-Unmodified-Since,X-Requested-With'); } /** * @return \think\response\Json * @author: LuckyHhy <jackhhy520@qq.com> * @date: 2020/3/12 * @name: miss * @describe: */ public function miss() { return json([ 'errno' => \ERRNO['PARAMERR'], 'msg' => '访问接口不存在或参数错误']); } } ~~~ `