当前位置:网站首页>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
边栏推荐
- Comment développer un plug - in d'applet
- 70. Climbing Stairs. Sol
- Sub total of Pico development
- BFC block level formatting context
- Go语言学习教程(十五)
- Overview of database recovery
- Implementing Lmax disruptor queue from scratch (IV) principle analysis of multithreaded producer multiproducersequencer
- MySQL actual combat 45 lecture learning (I)
- 实战:fabric 用户证书吊销操作流程
- U盘的文件无法删除文件怎么办?Win11无法删除U盘文件解决教程
猜你喜欢

Learning of mall permission module

Index optimization of performance tuning methodology

How to quickly experience oneos

Granularity of blocking of concurrency control

Matlab draws a cute fat doll

Analysis of the problem that the cookie value in PHP contains a plus sign (+) and becomes a space

点到直线的距离直线的交点及夹角

Leetcode simple question: check whether each row and column contain all integers

MySQL disconnection reports an error MySQL ldb_ exceptions. OperationalError 4031, The client was disconnected by the server

Stored procedures and stored functions
随机推荐
EasyCVR集群部署如何解决项目中的海量视频接入与大并发需求?
Concurrency control of performance tuning methodology
C language - structural basis
Oracle advanced query
GWT module may need to be (RE) compiled reduce - GWT module may need to be (RE) compiled reduce
[agc009e] eternal average - conclusion, DP
Interview questions for famous enterprises: Coins represent a given value
Distance from point to line intersection and included angle of line
Granularity of blocking of concurrency control
Nacos 的安装与服务的注册
Sub total of Pico development
BFC block level formatting context
509. Fibonacci Number. Sol
Blocking of concurrency control
Business learning of mall commodity module
boundary IoU 的计算方式
Talking about MySQL index
Performance testing of software testing
Binary tree (II) -- code implementation of heap
Metaverse Ape猿界应邀出席2022·粤港澳大湾区元宇宙和web3.0主题峰会,分享猿界在Web3时代从技术到应用的文明进化历程