Zend Date is giving me fatal error msg
I just want to use a few classes Zend offe开发者_如何学JAVArs, 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());
Here's the error: Fatal error: Class 'Zend_Date' not found
Do I have to go through the steps to change the configuration files for apache, and php just to use this one class?
Any help is appreciated. Thanks.
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.
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'
);
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();
精彩评论