0
我有ZF2应用程序,在根级别我有我的供应商文件夹。 (经典骨架应用程序) 在供应商中,包含了所有我更新并与作曲家一起安装的库。psr 4 - zf2加载自定义类
供应商有需要添加自定义类并自动加载它。
使用作曲家,写这样
"autoload": {
"psr-4": {
"ciromar\\": "/vendor/ciromar/src"
}
一个autolader现在的文件夹结构如下:
vendor
--ciromar
---- src
------ Log
-------- Writer
---------- FileRotator.php (class)
类的命名空间是FileRotator.php
namespace ciromar\Log\Writer;
我的应用程序的控制器
use ciromar\Log\Writer\FileRotator;
IndexController class extends AbstractActionController
{
public function indexAction()
{
$fr = new FileRotator("");
}
}
错误
Fatal error: Class 'ciromar\Log\Writer\FileRotator' not found in /var/www/html/myapp/module/Application/src/Application/Controller/IndexController.php on line 21
好的,我来解决。我需要以这种方式设置路径'。/ vendor/ciromar/src' – ciro 2014-10-06 09:14:21