当前位置:网站首页>Thinkphp5.1 cross domain problem solving
Thinkphp5.1 cross domain problem solving
2022-07-05 22:26:00 【Mu Yan duck】
Create a new controller –Cross
php think make:controller api/Cross
Read the official documents tp5.1 Cross domain You can understand the basic writing method
Initialize the method in this controller
protected function initialize()
{
parent::initialize(); // TODO: Change the autogenerated stub
header('Access-Control-Allow-Origin:*');
header('Access-Control-Allow-Methods:GET, POST, PATCH, PUT, DELETE');
header('Access-Control-Allow-Headers:Authorization, Content-Type, If-Match, If-Modified-Since, If-None-Match, If-Unmodified-Since, X-Requested-With');
if (request()->isOptions()){
exit();
}
}
Problem solvable
边栏推荐
- 二叉树(二)——堆的代码实现
- 数博会精彩回顾 | 彰显科研实力,中创算力荣获数字化影响力企业奖
- 科技云报道:算力网络,还需跨越几道坎?
- Storage optimization of performance tuning methodology
- Leetcode simple question: the minimum cost of buying candy at a discount
- FBO and RBO disappeared in webgpu
- The difference between MVVM and MVC
- 如何开发引入小程序插件
- Unique occurrence times of leetcode simple questions
- The code generator has deoptimised the styling of xx/typescript.js as it exceeds the max of 500kb
猜你喜欢
Livelocks and deadlocks of concurrency control
点到直线的距离直线的交点及夹角
Leetcode simple question: check whether each row and column contain all integers
Recovery technology with checkpoints
Technology cloud report won the special contribution award for the 10th anniversary of 2013-2022 of the "cloud Ding Award" of the global cloud computing conference
90后测试员:“入职阿里,这一次,我决定不在跳槽了”
Business learning of mall order module
Matlab draws a cute fat doll
50. Pow(x, n). O(logN) Sol
Common interview questions of redis factory
随机推荐
The countdown to the launch of metaverse ape is hot
Comment développer un plug - in d'applet
Metasploit(msf)利用ms17_010(永恒之蓝)出现Encoding::UndefinedConversionError问题
FBO and RBO disappeared in webgpu
Solutions for unexplained downtime of MySQL services
Alternating merging strings of leetcode simple questions
ESP32 hosted
The code generator has deoptimised the styling of xx/typescript.js as it exceeds the max of 500kb
笔记本电脑蓝牙怎么用来连接耳机
Oracle views the data size of a table
元宇宙中的三大“派系”
Overview of database recovery
Post-90s tester: "after joining Ali, this time, I decided not to change jobs."
Implementing Lmax disruptor queue from scratch (IV) principle analysis of multithreaded producer multiproducersequencer
Distance entre les points et les lignes
50. Pow(x, n). O(logN) Sol
Nacos installation and service registration
[groovy] groovy dynamic language features (automatic type inference of function arguments in groovy | precautions for function dynamic parameters)
點到直線的距離直線的交點及夾角
How to create a thread