头文件
<?php
header("Access-Control-Allow-Origin: *"); // 允许所有域名访问,出于安全考虑,最好指定具体的域名
header("Access-Control-Allow-Methods: GET, POST, OPTIONS, PUT, DELETE"); // 允许的HTTP方法
header("Access-Control-Allow-Headers: X-Requested-With,content-type,Accept,Origin,Authorization"); // 允许的HTTP头
header("Access-Control-Allow-Credentials: true"); // 是否允许发送Cookie
ini_set('display_errors', 1); // 显示错误
ini_set('display_startup_errors', 1); // 显示启动错误
error_reporting(E_ALL); // 报告所有类型的错误
$ip = $_SERVER['REMOTE_ADDR'];
$input =json_decode( file_get_contents('php://input'),true);
?>
打印所有代码(包括引入的)
$all_files = get_included_files();
foreach ($all_files as $file) {
echo "<h3>📄