从今天开始,我无法在 CakePHP 中隐藏 debugkit 工具栏。我的意思是,如果我点击蛋糕图标,工具栏不会向右滚动。
我知道我可以通过将 Debug 设置为 0 来禁用它。但是我需要调试输出。推出的工具栏隐藏了我的调试输出的代码行。我也不想更改此工具栏的 css 设置,因为我在共享项目中工作,不希望其他开发人员更改此设置。
是本地问题。我已经删除了蛋糕缓存,并且在私人模式下运行我的浏览器。酒吧总是完全出现。不仅显示蛋糕图标,还显示所有调试链接。我不知道为什么。这很神奇,但从今天开始,只需单击蛋糕图标就不会隐藏该栏。但是为什么???
问候
尝试从您的 AppController 中评论或删除 //'DebugKit.Toolbar'
在这种情况下,请尝试从布局中注释导入的 css(所有其他 css)。因为其他样式可能会破坏 DebugKit.Toolbar.
在浏览器中使用 ctrl+shift+i(检查元素 -> 控制台)查看 JS 是否损坏。
有些案例还说,如果您的数据库配置不正确,您将遇到 DebugKit.Toolbar 问题
要删除调试工具包图标(因此您的 html 中的工具栏元素)只需转到“app.php”并设置“debug => false”
在
config\bootstrap.php
以下行
if (Configure::read('debug')) { Plugin::load('DebugKit', ['bootstrap' => true]); }
会变成
if (Configure::read('debug')) { Plugin::load('DebugKit', ['bootstrap' => false]); }
转到 vendor/cakephp/debug_kit/webroot/js 然后禁用 onReady 函数中的所有内容。
例如:
var onReady = function() {
/* if (!win.__debug_kit_id) {
return;
}
var body = doc.body;
iframe = doc.createElement('iframe');
iframe.setAttribute('style', 'position: fixed; bottom: 0; right: 0; border: 0; outline: 0; overflow: hidden; z-index: 99999;');
iframe.height = 40;
iframe.width = 40;
iframe.src = __debug_kit_base_url + 'debug_kit/toolbar/' + __debug_kit_id;
body.appendChild(iframe);
bodyOverflow = body.style.overflow;
window.addEventListener('message', onMessage, false); */
};
app.php
第一行之一
'debug' => filter_var(env('DEBUG', true), FILTER_VALIDATE_BOOLEAN),
改变这个 --------------------------------------^
'debug' => filter_var(env('DEBUG', false), FILTER_VALIDATE_BOOLEAN),
转到htdocs/my_app_name/src/Application.php 评论这一行
if (Configure::read('debug')) {
// $this->addPlugin('DebugKit');
}
你的代码
if (Configure::read('debug')) {
// $this->addPlugin('DebugKit');
}
重新加载页面