【类 型】:fix
【主 题】:跨域 请求头报错 【描 述】: [原因]: [过程]:重新设置请求方法 请求头 [影响]: 【结 束】 # 类型 包含: # feat:新功能(feature) # fix:修补bug # docs:文档(documentation) # style: 格式(不影响代码运行的变动) # refactor:重构(即不是新增功能,也不是修改bug的代码变动) # test:增加测试 # chore:构建过程或辅助工具的变动
This commit is contained in:
parent
851b9bcb93
commit
beede66837
@ -18,8 +18,9 @@ class PublicController extends Controller
|
|||||||
protected $tokenShop_id;
|
protected $tokenShop_id;
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
header("Access-Control-Allow-Origin: " . C('LimitApi')); //请求域名限制
|
header("Access-Control-Allow-Origin: *"); // 允许所有来源
|
||||||
header('Access-Control-Allow-Headers:Token'); //token请求头
|
header("Access-Control-Allow-Methods: GET, POST, OPTIONS"); // 允许的请求方法
|
||||||
|
header("Access-Control-Allow-Headers: Content-Type, Authorization,Token"); // 允许的请求头
|
||||||
// 获取请求头中的 Token
|
// 获取请求头中的 Token
|
||||||
$token = isset($_SERVER['HTTP_TOKEN']) ? $_SERVER['HTTP_TOKEN'] : null;
|
$token = isset($_SERVER['HTTP_TOKEN']) ? $_SERVER['HTTP_TOKEN'] : null;
|
||||||
// 获取 jwt 密钥
|
// 获取 jwt 密钥
|
||||||
|
Loading…
Reference in New Issue
Block a user