Created
June 20, 2017 08:34
-
-
Save easychen/0e420ef253e971483a7b0ef50440ee4d to your computer and use it in GitHub Desktop.
让PHP build-in web server支持跨域: php -S locahost:4000 route.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
<?php | |
if (file_exists($_SERVER["SCRIPT_FILENAME"])) | |
{ | |
header('Access-Control-Allow-Origin: *'); | |
header('Access-Control-Allow-Headers: origin,x-requested-with,content-type'); | |
header('Access-Control-Allow-Methods: PUT,GET,POST,DELETE,OPTIONS'); | |
readfile($_SERVER["SCRIPT_FILENAME"]); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment