Zend Framework 的自动加载器问题
一切都在index.php
/* Define site root */
defined('DOCUMENT_ROOT') ? null : define('DOCUMENT_ROOT',realpath(dirname(__FILE__)));
defined('SITE_ROOT') ? null : define('SITE_ROOT',realpath(dirname(DOCUMENT_ROOT.'../')));
// Define path to application directory
defined('APPLICATION_PATH')
|| define('APPLICATION_PATH', SITE_ROOT . '/application');
$includePath[] = '.';
$includePath[] = SITE_ROOT . '/library';
$includePath[] = get_include_path();
$includePath = implode(PATH_SEPARATOR,$includePath);
set_include_path($includePath);
require_once 'Zend/Loader/Autoloader.php';
Zend_Loader_Autoloader::getInstance();
/* Adding action helpers path */
Zend_Controller_Action_HelperBroker::addPath(APPLICATION_PATH . '/controllers/helpers','Helper');
$application->bootstrap()
->run();
收到这些错误以及更多捆绑 ZF 助手的错误路径,出了什么问题?
/* 设置表单及其元素的装饰器路径和前缀 / $form->addElementPrefixPath('Form', SITE_ROOT . '/library/form/decorators', 'decorator'); // 前缀、路径、类型 / 设置额外的验证器 */ $form->addElementPrefixPath('Form', SITE_ROOT . '/library/form/validators', 'validate'); // prefi、path、type
[2] fopen(/var/www/vhosts/blabla.com/httpdocs/application/controllers/helpers/ViewRenderer.php) [<a href='function.fopen'>function.fopen</a>]: failed to open stream: No such file or directory
in file: /var/www/vhosts/blabla.com/httpdocs/library/Zend/Loader.php
on line: 165
[2] fopen(/var/www/vhosts/blabla.com/httpdocs/library/form/validators/NotEmpty.php) [<a href='function.fopen'>function.fopen</a>]: failed to open stream: No such file or directory
in file: /var/www/vhosts/blabla.com/httpdocs/library/Zend/Loader.php
on line: 165
[2] fopen(/var/www/vhosts/blabla.com/httpdocs/library/form/validators/InArray.php) [<a href='function.fopen'>function.fopen</a>]: failed to open stream: No such file or directory
in file: /var/www/vhosts/blabla.com/httpdocs/library/Zend/Loader.php
on line: 165
[2] fopen(/var/www/vhosts/blabla.com/httpdocs/library/form/validators/NotEmpty.php) [<a href='function.fopen'>function.fopen</a>]: failed to open stream: No such file or directory
in file: /var/www/vhosts/blabla.com/httpdocs/library/Zend/Loader.php
on line: 165
[2] fopen(/var/www/vhosts/blabla.com/httpdocs/library/form/validators/InArray.php) [<a href='function.fopen'>function.fopen</a>]: failed to open stream: No such file or directory
in file: /var/www/vhosts/blabla.com/httpdocs/library/Zend/Loader.php
on line: 165
[2] fopen(/var/www/vhosts/blabla.com/httpdocs/library/form/validators/InArray.php) [<a href='function.fopen'>function.fopen</a>]: failed to open stream: No such file or directory
in file: /var/www/vhosts/blabla.com/httpdocs/library/Zend/Loader.php
on line: 165
[2] fopen(/var/www/vhosts/blabla.com/httpdocs/library/form/validators/NotEmpty.php) [<a href='function.fopen'>function.fopen</a>]: failed to open stream: No such file or directory
in file: /var/www/vhosts/blabla.com/httpdocs/library/Zend/Loader.php
on line: 165
[2] fopen(/var/www/vhosts/blabla.com/httpdocs/library/form/validators/NotEmpty.php) [<a href='function.fopen'>function.fopen</a>]: failed to open stream: No such file or directory
in file: /var/www/vhosts/blabla.com/httpdocs/library/Zend/Loader.php
on line: 165
[2] fopen(/var/www/vhosts/blabla.com/httpdocs/library/form/validators/InArray.php) [<a href='function.fopen'>function.fopen</a>]: failed to open stream: No such file or directory
in file: /var/www/vhosts/blabla.com/httpdocs/library/Zend/Loader.php
on line: 165
[2] fopen(/var/www/vhosts/blabla.com/httpdocs/library/form/validators/NotEmpty.php) [<a href='function.fopen'>function.fopen</a>]: failed to open stream: No such file or directory
in file: /var/www/vhosts/blabla.com/httpdocs/library/Zend/Loader.php
on line: 165
[2] fopen(/var/www/vhosts/blabla.com/httpdocs/library/form/validators/NotEmpty.php) [<a href='function.fopen'>function.fopen</a>]: failed to open stream: No such file or directory
in file: /var/www/vhosts/blabla.com/httpdocs/library/Zend/Loader.php
on line: 165
与 ZF 验证器捆绑在一起位于此处:
例如library/Zend/Validate/InArray.php
那么自动加载器有什么问题呢?
it's all in index.php
/* Define site root */
defined('DOCUMENT_ROOT') ? null : define('DOCUMENT_ROOT',realpath(dirname(__FILE__)));
defined('SITE_ROOT') ? null : define('SITE_ROOT',realpath(dirname(DOCUMENT_ROOT.'../')));
// Define path to application directory
defined('APPLICATION_PATH')
|| define('APPLICATION_PATH', SITE_ROOT . '/application');
$includePath[] = '.';
$includePath[] = SITE_ROOT . '/library';
$includePath[] = get_include_path();
$includePath = implode(PATH_SEPARATOR,$includePath);
set_include_path($includePath);
require_once 'Zend/Loader/Autoloader.php';
Zend_Loader_Autoloader::getInstance();
/* Adding action helpers path */
Zend_Controller_Action_HelperBroker::addPath(APPLICATION_PATH . '/controllers/helpers','Helper');
$application->bootstrap()
->run();
Getting those error and a lot more with wrong paths to bundled ZF helpers, what's wrong?
/* Setting decorators path and prefix for form and it's elements /
$form->addElementPrefixPath('Form', SITE_ROOT . '/library/form/decorators', 'decorator'); // prefix, path, type
/ Setting additional validators */
$form->addElementPrefixPath('Form', SITE_ROOT . '/library/form/validators', 'validate'); // prefi, path, type
[2] fopen(/var/www/vhosts/blabla.com/httpdocs/application/controllers/helpers/ViewRenderer.php) [<a href='function.fopen'>function.fopen</a>]: failed to open stream: No such file or directory
in file: /var/www/vhosts/blabla.com/httpdocs/library/Zend/Loader.php
on line: 165
[2] fopen(/var/www/vhosts/blabla.com/httpdocs/library/form/validators/NotEmpty.php) [<a href='function.fopen'>function.fopen</a>]: failed to open stream: No such file or directory
in file: /var/www/vhosts/blabla.com/httpdocs/library/Zend/Loader.php
on line: 165
[2] fopen(/var/www/vhosts/blabla.com/httpdocs/library/form/validators/InArray.php) [<a href='function.fopen'>function.fopen</a>]: failed to open stream: No such file or directory
in file: /var/www/vhosts/blabla.com/httpdocs/library/Zend/Loader.php
on line: 165
[2] fopen(/var/www/vhosts/blabla.com/httpdocs/library/form/validators/NotEmpty.php) [<a href='function.fopen'>function.fopen</a>]: failed to open stream: No such file or directory
in file: /var/www/vhosts/blabla.com/httpdocs/library/Zend/Loader.php
on line: 165
[2] fopen(/var/www/vhosts/blabla.com/httpdocs/library/form/validators/InArray.php) [<a href='function.fopen'>function.fopen</a>]: failed to open stream: No such file or directory
in file: /var/www/vhosts/blabla.com/httpdocs/library/Zend/Loader.php
on line: 165
[2] fopen(/var/www/vhosts/blabla.com/httpdocs/library/form/validators/InArray.php) [<a href='function.fopen'>function.fopen</a>]: failed to open stream: No such file or directory
in file: /var/www/vhosts/blabla.com/httpdocs/library/Zend/Loader.php
on line: 165
[2] fopen(/var/www/vhosts/blabla.com/httpdocs/library/form/validators/NotEmpty.php) [<a href='function.fopen'>function.fopen</a>]: failed to open stream: No such file or directory
in file: /var/www/vhosts/blabla.com/httpdocs/library/Zend/Loader.php
on line: 165
[2] fopen(/var/www/vhosts/blabla.com/httpdocs/library/form/validators/NotEmpty.php) [<a href='function.fopen'>function.fopen</a>]: failed to open stream: No such file or directory
in file: /var/www/vhosts/blabla.com/httpdocs/library/Zend/Loader.php
on line: 165
[2] fopen(/var/www/vhosts/blabla.com/httpdocs/library/form/validators/InArray.php) [<a href='function.fopen'>function.fopen</a>]: failed to open stream: No such file or directory
in file: /var/www/vhosts/blabla.com/httpdocs/library/Zend/Loader.php
on line: 165
[2] fopen(/var/www/vhosts/blabla.com/httpdocs/library/form/validators/NotEmpty.php) [<a href='function.fopen'>function.fopen</a>]: failed to open stream: No such file or directory
in file: /var/www/vhosts/blabla.com/httpdocs/library/Zend/Loader.php
on line: 165
[2] fopen(/var/www/vhosts/blabla.com/httpdocs/library/form/validators/NotEmpty.php) [<a href='function.fopen'>function.fopen</a>]: failed to open stream: No such file or directory
in file: /var/www/vhosts/blabla.com/httpdocs/library/Zend/Loader.php
on line: 165
Bundled with ZF validators are located here:
library/Zend/Validate/InArray.php for example
What's wrong with autoloader then?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
从
defines
中删除realpath
并调试您定义的路径是否正确。这似乎是连线的:
不应该是:
或者:
另外,请仔细检查文件权限。
Remove
realpath
from thedefines
and debug the paths which you define are correct.This seems wired:
shouldn't it be:
or:
Also, double chceck the file permissions.