TP5.x-- open cross-domain access

Foreword

Actually very simple, at the entrance of the file index.phpto add a few header on it.

Code

public/index.php

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");

Guess you like

Origin www.cnblogs.com/wangyang0210/p/10971609.html