如何在CakePHP上安装DebugKit [英] How to Install DebugKit on CakePHP
问题描述
我正在学习如何使用 CakePHP
和我配置一切都好,但现在,我得到这个警告:
未安装DebugKit。它将帮助您检查和调试应用程序的不同方面。您可以从github安装它
我已经点击了该链接,并下载了该应用程序,但我不知道放置这些文件夹...我使用 EasyPhp 作为我的网络托管服务商。
也这里我按照步骤
,并且有:
`确保插件通过调用CakePlugin :: load('DebugKit');`
加载到app / Config / bootstrap.php中
但是我不知道如何调用
这里的东西,有提示吗?
如何为CakePHP安装DebugKit(仅需4个简单步骤即可完成) :
第1步(选项A):传统/下载方法:
创建 DebugKit $ c $在
app / Plugin
目录中的c>文件夹,并将下载的内容放入其中(而不是顶层文件夹 - 其中的东西)。
第1步(选项B):如果你知道如何从github克隆,作曲家方法
这似乎是目前最受欢迎的选择(很好的原因)。如果您已经在使用 Composer [在此处了解更多信息] ,那么添加DebugKit是非常简单的。如果你以前没有使用Composer,不要担心 - 只使用上面的选项A。
确保require存在于composer.json中。这会将
插件安装到Plugin / DebugKit中:
{
require:{
cakephp / debug_kit:2.2。*
}
}
步骤2:
app / Config / bootstrap.php
,添加(或取消注释)以下行:
CakePlugin :: load('DebugKit');
最后,在 app / Controller / AppController.php
文件(在类中),添加:
public $ components = array(
'DebugKit.Toolbar '
);
(如果您已有 $ components
步骤3:确保debug is 1 or more
在 Config / core.php
文件中, :
Configure :: write('debug',2);
的值为1或2. (详细了解调试模式)
第4步:删除 sql_dump
:
,删除'sql_dump'元素(在默认布局的底部)
的 debugKit页面部分:
- 将此目录中的文件克隆/复制到app / Plugin / DebugKit
- 确保插件已加载到app / Config / bootstrap.php中,方法是调用CakePlugin :: load 'DebugKit');
- 在AppController.php中包含工具栏组件:
public $ components = array('DebugKit.Toolbar'); - 将调试模式设置为至少1个。
- 如果您想体验真正的调试工具包SQL日志,请确保从布局中删除sql_dump元素。
如何知道它是否有效? / p>
您应该会在网站右上角的灰色方块上看到一个小图标。点击这里展开选项,然后点击一个选项开始真棒。
I'm learning how to work with CakePHP
and I configured everything allright, but now, I get this warning:
DebugKit is not installed. It will help you inspect and debug different aspects of your application. You can install it from github
I already clicked on that link, and downloaded that app, but I have no idea where to place these folders... I'm using EasyPhp as my web host.
Also Here I followed the steps,
and there is:
`Ensure the plugin is loaded in app/Config/bootstrap.php by calling CakePlugin::load('DebugKit');`
But I don't know how to call
something here, is there a prompt ?
How to Install DebugKit for CakePHP (in just 4 easy steps!):
STEP 1 (option A): The traditional / download method:
Create a DebugKit
folder within your app/Plugin
directory, and put the contents of the download into it (not the top-level folder - the stuff within it). If you know how to clone from github, that works fine also.
STEP 1 (option B): The Composer method
This seems to currently be the most popular option (and for good reason). If you're already using Composer [find out more about it here], then adding DebugKit is crazy-simple. If you haven't used Composer before, don't worry - just use "option A" above. The end-result is the same, and it's easy too.
Ensure require is present in composer.json. This will install the plugin into Plugin/DebugKit:
{
"require": {
"cakephp/debug_kit": "2.2.*"
}
}
STEP 2:
Then, in your app/Config/bootstrap.php
, add (or un-comment) the following line:
CakePlugin::load('DebugKit');
Lastly, in your app/Controller/AppController.php
file (within the class), add:
public $components = array(
'DebugKit.Toolbar'
);
(If you already have a $components
array, then just add to it - don't re-set it.)
STEP 3: Ensure debug is 1 or more
In your Config/core.php
file, make sure this line:
Configure::write('debug', 2);
has a value of 1 or 2. (read more about debug mode here)
STEP 4: Remove sql_dump
:
In your layout file, remove the 'sql_dump' element (at the bottom of the default layout)
According to the "Installation" section on the debugKit page:
- Clone/Copy the files in this directory into app/Plugin/DebugKit
- Ensure the plugin is loaded in app/Config/bootstrap.php by calling CakePlugin::load('DebugKit');
- Include the toolbar component in your AppController.php: public $components = array('DebugKit.Toolbar');
- Set debug mode to at least 1.
- Make sure to remove the 'sql_dump' element from your layout if you want to experience the awesome that is the debug kit SQL log.
How do I know if it's working?
You should see a small icon on a gray square in the upper right corner of your site. Click on this to expand the options, then click on an option to start being awesome.
这篇关于如何在CakePHP上安装DebugKit的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!