当前位置:网站首页>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
边栏推荐
- The simple problem of leetcode is to split a string into several groups of length K
- MySQL disconnection reports an error MySQL ldb_ exceptions. OperationalError 4031, The client was disconnected by the server
- [Chongqing Guangdong education] National Open University autumn 2018 0088-21t Insurance Introduction reference questions
- Two stage locking protocol for concurrency control
- Granularity of blocking of concurrency control
- Type of fault
- MySQL服务莫名宕机的解决方案
- 2022-07-05:给定一个数组,想随时查询任何范围上的最大值。 如果只是根据初始数组建立、并且以后没有修改, 那么RMQ方法比线段树方法好实现,时间复杂度O(N*logN),额外空间复杂度O(N*
- 科技云报道:算力网络,还需跨越几道坎?
- C language - structural basis
猜你喜欢

从 1.5 开始搭建一个微服务框架——日志追踪 traceId

Win11 runs CMD to prompt the solution of "the requested operation needs to be promoted"

Metaverse ape ape community was invited to attend the 2022 Guangdong Hong Kong Macao Great Bay metauniverse and Web3.0 theme summit to share the evolution of ape community civilization from technology

Business learning of mall order module
![[groovy] groovy dynamic language features (automatic type inference of function arguments in groovy | precautions for function dynamic parameters)](/img/ab/086c7455706eecc467eef92c660803.jpg)
[groovy] groovy dynamic language features (automatic type inference of function arguments in groovy | precautions for function dynamic parameters)

Cobaltstrike builds an intranet tunnel

Sentinel production environment practice (I)

MySQL actual combat 45 lecture learning (I)

Damn, window in ie open()

Oracle hint understanding
随机推荐
航海日答题小程序之航海知识竞赛初赛
请求二进制数据和base64格式数据的预览显示
boundary IoU 的计算方式
2022-07-05:给定一个数组,想随时查询任何范围上的最大值。 如果只是根据初始数组建立、并且以后没有修改, 那么RMQ方法比线段树方法好实现,时间复杂度O(N*logN),额外空间复杂度O(N*
科技云报道:算力网络,还需跨越几道坎?
Golang writes the opening chapter of selenium framework
Leetcode simple question check whether all characters appear the same number of times
Wonderful review of the digital Expo | highlight scientific research strength, and Zhongchuang computing power won the digital influence enterprise award
How can Bluetooth in notebook computer be used to connect headphones
What if the files on the USB flash disk cannot be deleted? Win11 unable to delete U disk file solution tutorial
Technology cloud report: how many hurdles does the computing power network need to cross?
Metaverse Ape获Negentropy Capital种子轮融资350万美元
The code generator has deoptimised the styling of xx/typescript.js as it exceeds the max of 500kb
Granularity of blocking of concurrency control
Pl/sql basic case
U盘的文件无法删除文件怎么办?Win11无法删除U盘文件解决教程
记录几个常见问题(202207)
How to develop and introduce applet plug-ins
A trip to Suzhou during the Dragon Boat Festival holiday
The statistics of leetcode simple question is the public string that has appeared once