TP5.x——開啓跨域訪問

前言

其實很簡單,在入口文件的index.php添加幾句header就能夠了.php

代碼

public/index.phpcode

header("Access-Control-Allow-Origin:*");
header("Access-Control-Allow-Methods:GET, POST, OPTIONS, DELETE");
header("Access-Control-Allow-Headers:DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type, Accept-Language, Origin, Accept-Encoding");
相關文章
相關標籤/搜索