Zend Date 给我致命错误消息 [英] Zend Date is giving me fatal error msg
问题描述
我只想使用 Zend 提供的几个类、Zend Date、Zend Mail 和其他一些类,但我什至无法获取日期来做任何事情.我以这种方式包含它:
I just want to use a few classes Zend offers, Zend Date, Zend Mail, and a few others, but I can't get the date one to even do anything. I've included it this way:
include_once '../classes/zend/library/zend/date/DateObject.php';$date = new Zend_Date(time());
include_once '../classes/zend/library/zend/date/DateObject.php'; $date = new Zend_Date(time());
这是错误:致命错误:未找到Zend_Date"类
Here's the error: Fatal error: Class 'Zend_Date' not found
我是否必须通过步骤更改 apache 和 php 的配置文件才能使用这一类?
Do I have to go through the steps to change the configuration files for apache, and php just to use this one class?
感谢任何帮助.谢谢.
推荐答案
您需要 Zend/Date.php,而不是 Zend/Date/DateObject.php.此外,您可能需要一些自动加载器来加载 Zend_Date 所依赖的其他类,但可能不需要,因为它们通常已经自动包含在 Zend 类文件中.
You need Zend/Date.php, not Zend/Date/DateObject.php. Furthermore, you might need some autoloader to load other classes that Zend_Date depends on, but probably not, as they are usually automatically included in the Zend class files already.
让我更正我的最后一句话.作为最低要求,您需要在包含路径中包含 Zend 库的路径.例如,像这样:
Let me correct my last statement. As a minumum you need to include the path to the Zend library in your include paths. For instance, like so:
// first entry are the already defined include paths,
// second entry is path to Zend library
set_include_path(
get_include_path() . PATH_SEPARATOR .
'path/to/library'
);
因此,以路径 C:\library\Zend
作为 Zend 库为例,然后您必须将 C:\library
添加到您的包含路径.这样,Zend 组件中的所有 require|include(_once) 语句都在正确的包含路径中.
So, take for example the path C:\library\Zend
as you Zend library, you would then have to add C:\library
to your include path. This way all require|include(_once) statements in Zend components look in the right include paths.
此外,您还可以像这样简单地包含正确的组件:
Furthermore you can then also simply include the right component like so:
require_once 'Zend/Date.php';
$date = new Zend_Date();
这篇关于Zend Date 给我致命错误消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!