【问题标题】:How to use DebugKit toolbar in cakephp 2.1.3 or cakephp 2.0如何在 cakephp 2.1.3 或 cakephp 2.0 中使用 DebugKit 工具栏
【发布时间】:2012-05-29 07:59:47
【问题描述】:

我曾尝试为cakephp 2.1.3 使用 cakephp Debugkit 工具栏...但它不能正常工作..

我已经在cakephp 1.3 上实现了调试工具包,它工作正常..

我为cakephp 2.1.3 下载了调试工具包。我重新检查了..

我是如何实现的??

app/plugin/DebugKit   ///this is my path for debugkit

我检查了我的调试模式是 2..

Configure::write('debug', 2);

我如何在 Appcontroller 中加载我的调试工具包..'

public $components = array('DebugKit.Toolbar');

显示错误

Parse error: syntax error, unexpected T_FUNCTION in /var/www/guest1/cakephp-2.1.3/app/Plugin/debug_kit/Controller/Component/ToolbarComponent.php on line 165

我从不同的来源下载调试工具包,但结果相同。

谢谢!

这个函数和行显示错误

public function implementedEvents() {
    $before = function ($name) {
        return function () use ($name) {
            DebugTimer::start($name, __d('debug_kit', $name));
        };
    };
    $after = function ($name) {
        return function () use ($name) {
            DebugTimer::stop($name);
        };
    };

最后我在 bootstrap.php 中加载了文件

CakePlugin::loadAll(); 

错误:-

    Error: DebugKit.ToolbarComponent could not be found.

Error: Create the class ToolbarComponent below in file: /var/www/guest1/cakephp-2.1.3/app/Plugin/DebugKit/Controller/Component/ToolbarComponent.php

【问题讨论】:

  • 你能告诉我们ToolbarComponent.php中的第165行看起来像E吗?
  • @SiGanteng 看到我用第 no 行更新了我的错误

标签: cakephp cakephp-2.0 cakephp-2.1


【解决方案1】:

您已下载最新版本的 DebugKit 插件,该插件使用 closures。如您所见,您至少需要 PHP 5.3 才能使其工作。

只需下载与您的 PHP 版本兼容的早期版本的 DebugKit。

【讨论】:

  • 我试过了,但是..它显示错误,错误:找不到 DebugKit.ToolbarComponent。和错误:在文件中创建下面的类 ToolbarComponent:/var/www/guest1/cakephp-2.1.3/app/Plugin/debug_kit/Controller/Component/ToolbarComponent.php ..
  • @Learner:插件的文件夹名称应该是DebugKit,而不是debug_kit,蛋糕2中也更改了。
  • @Learner:只是为了确保.. 1)您是否在引导程序中加载了插件? 2)你确定文件存在吗?如果您尝试在编辑器中打开文件路径会发生什么? 3) 你能发布新的错误信息和你的文件的位置吗?
  • @Learner:如果你在终端中输入cat /var/www/guest1/cakephp-2.1.3/app/Plugin/DebugKit/Controller/Component/ToolbarComponent.php,你会得到文件内容吗?如果是,您可能想检查文件/文件夹权限,也许您的服务器用户无法访问新部署的插件?你的 php/cakephp/apache 日志中有什么东西吗?
  • 我检查了..文件是否存在..我在终端中运行该命令。我为此授予了 777 权限..但是这个错误:---解析错误:语法错误,/中的意外 T_FUNCTION var/www/guest1/cakephp-2.1.3/app/Plugin/DebugKit/Controller/Component/ToolbarComponent.php 在第 165 行
【解决方案2】:

我也有同样的问题。我猜如果您使用的是 Cakphp 2.0 及更高版本,则不能使用低于 2 的 Debugkit 版本,因为它具有不同的插件名称约定。文件具有不同的树结构。

所以你所要做的就是使用较低版本并重命名文件或更新 PHP 或使用较低版本的 Cakephp。

【讨论】:

    【解决方案3】:

    我遇到了同样的问题。 DebugKit 在我的本地服务器上工作,但在网上因同样的错误而崩溃。问题是我没有数据库连接。在我成功连接到数据库后,debugkit 工作正常。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-10-04
      • 1970-01-01
      • 2013-02-13
      • 1970-01-01
      • 1970-01-01
      • 2015-01-27
      相关资源
      最近更新 更多