当前位置:网站首页>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
边栏推荐
- Oracle is sorted by creation time. If the creation time is empty, the record is placed last
- Promql demo service
- Some tutorials install the database on ubantu so as not to occupy computer memory?
- 请求二进制数据和base64格式数据的预览显示
- What about data leakage? " Watson k'7 moves to eliminate security threats
- Postman core function analysis - parameterization and test report
- 2022 Software Test Engineer salary increase strategy, how to reach 30K in three years
- MySQL服务莫名宕机的解决方案
- Form artifact
- ESP32 hosted
猜你喜欢
Interprocess communication in the "Chris Richardson microservice series" microservice architecture
实战:fabric 用户证书吊销操作流程
Leetcode simple question: find the nearest point with the same X or Y coordinate
Performance monitoring of database tuning solutions
2022-07-05: given an array, you want to query the maximum value in any range at any time. If it is only established according to the initial array and has not been modified in the future, the RMQ meth
Overview of concurrency control
database mirroring
2022 Software Test Engineer salary increase strategy, how to reach 30K in three years
CA certificate trampled pit
Three "factions" in the metauniverse
随机推荐
[agc009e] eternal average - conclusion, DP
2022-07-05: given an array, you want to query the maximum value in any range at any time. If it is only established according to the initial array and has not been modified in the future, the RMQ meth
Oracle is sorted by creation time. If the creation time is empty, the record is placed last
Overview of database recovery
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
航海日答题小程序之航海知识竞赛初赛
如何開發引入小程序插件
Practice: fabric user certificate revocation operation process
科技云报道荣膺全球云计算大会“云鼎奖”2013-2022十周年特别贡献奖
Implementing Lmax disruptor queue from scratch (IV) principle analysis of multithreaded producer multiproducersequencer
数博会精彩回顾 | 彰显科研实力,中创算力荣获数字化影响力企业奖
點到直線的距離直線的交點及夾角
The countdown to the launch of metaverse ape is hot
Metaverse Ape上线倒计时,推荐活动火爆进行
ESP32 hosted
Understand the basic concept of datastore in Android kotlin and why SharedPreferences should be stopped in Android
Sparse array [matrix]
Hcip day 16
What about data leakage? " Watson k'7 moves to eliminate security threats
Alternating merging strings of leetcode simple questions