我在尝试使用 Translate 类时收到 Zend 框架的一个奇怪的致命错误,它似乎试图加载一个以致命错误结尾的空文件名 (.php)。
下面是堆栈跟踪
[error] [client 79.160.197.135] PHP Warning: include_once() [<a href='function.include'>function.include</a>]: Failed opening '.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /usr/share/php/Zend/Loader.php on line 146, referer: index.php
[error] [client 79.160.197.135] PHP Stack trace:, referer: index.php
[error] [client 79.160.197.135] PHP 1. {main}() /doc/index.php:0, referer: index.php
[error] [client 79.160.197.135] PHP 2. Zend_Translate->__construct() /doc/index.php:19, referer: index.php
[error] [client 79.160.197.135] PHP 3. Zend_Translate->setAdapter() /usr/share/php/Zend/Translate.php:89, referer: index.php
[error] [client 79.160.197.135] PHP 4. Zend_Loader::loadClass() /usr/share/php/Zend/Translate.php:127, referer: index.php
[error] [client 79.160.197.135] PHP 5. Zend_Loader::loadFile() /usr/share/php/Zend/Loader.php:94, referer: index.php
[error] [client 79.160.197.135] PHP Fatal error: Uncaught exception 'Zend_Exception' with message 'File ".php" does not exist or class "" was not found in the file' in /usr/share/php/Zend/Loader.php:99
作为参考,我调用zend翻译类的方式如下
<?php
require_once( 'Zend/Loader.php' );
Zend_Loader::loadClass( 'Zend_Translate' );
$translate = new Zend_Translate(
array(
'gettext',
'locale',
null,
array('scan' => Zend_Translate::LOCALE_DIRECTORY)
)
);
?>
$translate 部分是调用导致崩溃的类的部分。