Created
March 1, 2023 11:28
-
-
Save zguillez/fd1ea755e0568a94ba142be98a6f4767 to your computer and use it in GitHub Desktop.
Allow cors in PHP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
header("Content-Type: application/json;charset=utf-8"); | |
header("Access-Control-Allow-Origin: *"); | |
header("Access-Control-Allow-Headers: Content-Type, Authorization"); | |
header("Access-Control-Allow-Methods: POST, OPTIONS"); | |
header("Allow: POST, OPTIONS"); | |
$method = $_SERVER['REQUEST_METHOD']; | |
if ($method == "OPTIONS") { | |
die(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment