【发布时间】:2015-12-16 22:13:21
【问题描述】:
我对在 index.php 中注册的命名空间与实现关联命名空间的类之间的冲突感到非常困惑。 在 index.php 中:
$loader->registerNamespaces(
array(
'Akademik\Controllers' => __DIR__ . $config->application->controllersDir,
'Akademik\Plugins' => __DIR__ . $config->application->pluginsDir,
'Akademik\Library' => __DIR__ . $config->application->libraryDir,
'Akademik\Models' => __DIR__ . $config->application->modelsDir,
))->register();
在我的课堂上:
namespace Akademik\Plugins;
use Phalcon\Mvc\User\Plugin;
use Phalcon\Events\Event;
use Phalcon\Mvc\Dispatcher;
use Phalcon\Acl;
class Security extends Plugin
{
public function __construct($dependencyInjector)
{
$this->_dependencyInjector = $dependencyInjector;
}
public function getAcl()
{
if (!isset($this->persistent->acl)) {
$acl = new Phalcon\Acl\Adapter\Memory();
当我启动 index.php 时,我得到了:
Fatal error: Class 'Akademik\Plugins\Phalcon\Acl\Adapter\Memory' not found in C:\nginx\html\app\plugins\Security.php on line 27
我是 phalcon 的新手,还有命名空间,任何帮助将不胜感激。提示
【问题讨论】:
标签: class namespaces