我想将我的自定义类“Authentication.php”添加到我的项目中,但我不知道该怎么做?
我已经阅读了很多关于外部库的教程,但没有一个有效。
ZendFramework/module/Firewall/Module.php
我该如何在我的控制器中调用外部库?
非常感谢您!
我已经阅读了很多关于外部库的教程,但没有一个有效。
ZendFramework/module/Firewall/Module.php
class Module
{
public function onBootstrap(MvcEvent $e)
{
$eventManager = $e->getApplication()->getEventManager();
$moduleRouteListener = new ModuleRouteListener();
$moduleRouteListener->attach($eventManager);
}
public function getConfig()
{
return include __DIR__ . '/config/module.config.php';
}
public function getAutoloaderConfig()
{
return array(
'Zend\Loader\StandardAutoloader' => array(
'namespaces' => array(
__NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__,
'MyNamespace' => __DIR__ . '/../../vendor/MyNamespace/lib/MyNamespace',
),
),
);
}
}
ZendFramework/vendor/MyNamespace/lib/MyNamespace/Authentication.php
可能是一个与身份验证相关的 PHP 文件路径。<?php
class Authentication {
public function test()
{
die('Works fine');
}
}
?>
我该如何在我的控制器中调用外部库?
非常感谢您!
Authentication.php
中添加命名空间部分了。 - Mohammad Mehdi Habibi