cache.html ------- 静态页面
static.php ---------PHP代码
time()){ //判断是否过期
echo file_get_contents($file);
}else{
unlink($file);
ob_start();
include('static.html');
$content = ob_get_contents();
file_put_contents($file,$content);
ob_end_flush();
}
}
?>
执行static.php时 调用静态页面可以执行ajax程序 为什么 我单独打开cache.html时ajax没有执行?
请问这是为什么呢
Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
打开控制台,下面有提示,
直接点击使用file协议打开,ajax请求跨域了
1.先确认是否已引入jquery
F12 看报错