开发者

PHP Zend framework: how to kill a very annoying and useless error

开发者 https://www.devze.com 2023-02-10 04:31 出处:网络
I am using the Zend GData library to integrate Google Calendar in my PHP application. I get tens of errors like this:

I am using the Zend GData library to integrate Google Calendar in my PHP application.

I get tens of errors like this:

Failed opening 'Zend/Gdata/Calendar/Content.php' for inclusion

but actually everything works awesomely (I am able to create/delete/update calendars and events)

I don't know exactly why I get that. Probably the Zend loader tries to load a file that doesn't exist (that is why the error) but, then, tries another location with success (that is why everything works).

By the way开发者_运维技巧 this is the bootstrap code I use for loading the Zend classes in my PHP script:

require_once 'Zend/Loader.php';
Zend_Loader::loadClass('Zend_Gdata');
Zend_Loader::loadClass('Zend_Gdata_AuthSub');
Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
Zend_Loader::loadClass('Zend_Gdata_Calendar');

What I want to achieve is to kill those error messages without killing other categories of relevant messages.

How would you achieve that?

I have tried to wrap everything in a try{} catch{} block but I still get those error messages.

Thanks,

Dan


Even if you use just few classes from Zend Framework it is recommended to upload the whole framework to your server to avoid any issues. It doesn't matter because you can still use just certain ZF classes and you will at least be sure there are no dependencies missing:

define('BASE_PATH', realpath(dirname(__FILE__).'/../'));
set_include_path(BASE_PATH.'/path/to/folder/where/zend/framework/is/located');

require_once('Zend/Loader/Autoloader.php');
$zendAutoloader = Zend_Loader_Autoloader::getInstance();

// that's all you need
// now you can use any class from the framework


Use the autoloader. Just set path to the Zend library using php's set_include_path(). And then use autoloader's getInstance() method to activate the autoloading. If you use other autoloaders, you can push them onto the stack (see manual).

0

精彩评论

暂无评论...
验证码 换一张
取 消