1

我正在尝试将Kint加载到我的第一个 Phalcon 项目中。我正在尝试使用loader.php来这样做。我尝试使用“registerDirs”、“registerClass”和“registerNamespaces”。

我习惯于通过 composer 在 Symfony2 中使用 Kint,但这次我尝试克隆 git repo 并将其放在这个 Pahlcon 项目的供应商文件夹中。我在require使用 Kint 类时得到的只是一个静默的 500 内部错误。以下是我目前拥有的代码。

<?php
# app/config/loader.php

$loader = new \Phalcon\Loader();

/**
 * We're a registering a set of directories taken from the configuration file
 */
$loader->registerDirs(
    array(
        $config->application->controllersDir,
        $config->application->modelsDir,
        '~/Code/incubator/Library/Phalcon',
        "vendor/kint"
    )
)->register();

和有问题的控制器:

<?php
# app/controllers/indexController.php

class IndexController extends ControllerBase
{
    public function indexAction()
    {
        Kint::dump("huh");
    }
}
4

1 回答 1

0

在引导程序中需要作曲家自动加载器:

在您的 public/index.php 中,包括作曲家自动加载器: https ://github.com/phalcon/forum/blob/master/public/index.php#L44

require realpath('..') . "/vendor/autoload.php";
于 2015-02-02T18:21:56.037 回答