增强对第三方API兼容性

This commit is contained in:
icret
2023-03-04 17:06:56 +08:00
parent 271d1a4785
commit 6cae61ee33
4 changed files with 17 additions and 11 deletions

View File

@@ -6,7 +6,12 @@ require_once __DIR__ . '/../application/function.php';
require_once APP_ROOT . '/application/class.upload.php';
require_once APP_ROOT . '/config/api_key.php';
header('Access-Control-Allow-Origin:*');
// 允许跨域 https://stackoverflow.com/questions/8719276/cross-origin-request-headerscors-with-php-headers
header("Access-Control-Max-Age: 3600");
header("Access-Control-Allow-Origin: *");
header("Access-Control-Allow-Credentials: true");
header("Access-Control-Allow-Methods: PUT, POST, GET, OPTIONS, DELETE");
header("Access-Control-Allow-Headers: X-Requested-With, Content-Type, Origin, Cache-Control, Pragma, Authorization, Accept, Accept-Encoding");
// 无文件
if (empty($_FILES['image'])) {