日本免费高清视频-国产福利视频导航-黄色在线播放国产-天天操天天操天天操天天操|www.shdianci.com

學無先后,達者為師

網站首頁 編程語言 正文

fastadmin uniapp跨域的問題

作者:左手江湖 更新時間: 2022-01-29 編程語言
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");

?把上面代碼加入到public/index.php入口文件,生產環境把header("Access-Control-Allow-Origin:*");后面星號換成允許的域名,安全起見

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



// [ 應用入口文件 ]
// 定義應用目錄
define('APP_PATH', __DIR__ . '/../application/');

// 判斷是否安裝
if (!is_file(APP_PATH . 'admin/command/Install/install.lock')) {
    header("location:./install.php");
    exit;
}

// 加載框架引導文件
require __DIR__ . '/../thinkphp/start.php';

?

原文鏈接:https://blog.csdn.net/shaofei1986/article/details/121517187

欄目分類
最近更新