我刚开始用这个框架编写代码。我将此代码添加到我的视图文件后的一个大问题(以添加的形式AJAX的支持):Cakephp创建了许多缓存文件
echo $this->Js->submit('Send',array(
'before'=> $this->Js->get('#success')->effect('fadeOut'),
'success'=>$this->Js->get('#success')->effect('fadeIn'),
'update'=>'#success'
));
我每次刷新页面,CakePHP的创建一个名为{}哈希文件.js文件像987276be3fa726db322142ee6dfee435。 js更重要的是,每一次刷新都需要5秒左右。 因此,经过几个小时的工作,我在/ webroot/js中有超过200个文件。 每个文件中包含这样的代码:
$(document).ready(function() {$("#submit-1856995147").bind("click", function (event) {$.ajax({beforeSend:function (XMLHttpRequest) {$("#success").fadeOut();}, data:$("#submit-1856995147").closest("form").serialize(), dataType:"html", success:function (data, textStatus) {$("#success").fadeIn();$("#success").html(data);}, type:"post", url:"\/newapp\/Sender"}); return false;});});
你知道如何解决这个问题?
是否在AppController中禁用了缓存...? – Yash
但在AppController中禁用缓存,例如。通过添加Controller :: disableCache();只告诉用户的浏览器不要缓存数据 - CakePHP在服务器端缓存JS,我想禁用它。 – user3770239