Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/280.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/visual-studio-2012/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
CakePHP。Ajax请求无法与debug=0一起使用_Php_Security_Cakephp - Fatal编程技术网

CakePHP。Ajax请求无法与debug=0一起使用

CakePHP。Ajax请求无法与debug=0一起使用,php,security,cakephp,Php,Security,Cakephp,我不知所措。我使用Ajax提交表单 submitForm: function(element) { $.post( webroot + 'users/settings', $('#AJAXform').serialize(), function() { var option = $('#AJAXform').find('select option:selected'); $j.current.

我不知所措。我使用Ajax提交表单

submitForm: function(element) {
    $.post(
        webroot + 'users/settings',
        $('#AJAXform').serialize(),
        function() {
            var option = $('#AJAXform').find('select option:selected');
            $j.current.v.updateField(element, option.text());
            $j.current.v.removeForms();
        }
    );
}
事实上,一切都很好。。。也就是说,直到我将调试级别设置为0

然后Ajax请求失败。但奇怪的是,通过Firebug,我可以看到我得到了一个404错误

找不到 错误: 在此服务器上找不到请求的地址“”/users/profile“

问题是我调用的不是页面/users/profile,而是/users/settings(users/profile是表单所在的页面)。这只在调试级别为0时发生。所以我想这和安全有关

有人可能认为我被黑了,但问题是安全组件目前没有激活;此外,黑洞应该发送一个空白页面,而不是错误404(对于错误页面更是如此)

编辑:我解决了。结果表明,这是响应中的重定向,它给出了一个错误。当debug=0时,将不会显示该错误,而是显示404。Firefox会猜测404消息(实际上没有发送)

我和你一起解决了

if ($this->RequestHandler->isAjax()) {
    $this->autoRender = false;
}

我解决了。结果表明,这是响应中的重定向,它给出了一个错误。当debug=0时,将不会显示该错误,而是显示404。Firefox会猜测404消息(实际上没有发送)

我解决了它。结果表明,这是响应中的重定向,它给出了一个错误。当debug=0时,将不会显示该错误,而是显示404。Firefox会猜测404消息(实际上没有发送)

如果你现在不打算删除问题,因为你自己已经解决了它(因此有相同问题的人可能会找到你的解决方案),考虑把标题改成更具描述性的东西,或者回答你的问题,这样它就关闭了,你现在不打算删除这个问题,既然你自己解决了(同样的问题的人可能会找到你的解决方案)。考虑把标题改成更具描述性的东西,或者回答你的问题,这样就结束了。