Zend Framework with Kohana PHP 3
I've put the Zend library folder into classes folder of my app and renamed all files and folders to lowercase ( using Ant Renamer ).
When I call Zend_Feed, instead of loading /classes/zend/feed.php, kohana loads Zend from my servers share\ZendFramework\library\Zend\
(Zend Server), so I get a Cannot redeclare class Zend_Uri_Http
error.
ZF version; 1.10 Kohana version: the most recent files available through GitHub
Edit: https://github.com/kolanos/kohan开发者_JS百科a-zend
Kohana autoloader expects lowercase filenames. You can register both Zend and Kohana autoloaders and it should work fine.
In bootstrap you have:
/**
* Enable the Kohana auto-loader.
*
* @see http://docs.kohanaphp.com/features/autoloading
* @see http://php.net/spl_autoload_register
*/
spl_autoload_register(array('Kohana', 'auto_load'));
Zend autoloader should go before or after that (I don't know if that makes a difference). Found a post how to do it: http://www.beyondcoding.com/2009/10/29/using-zend-framework-1-8-with-kohana/
its very important that your class name matches the file path in ko3. e.g. your feed class is inside /classes/zend/feed.php
so it must be named class Zend_Feed {
if you don't like this you can create this file /classes/feed.php
and do this class Feed extends Zend_Feed { }
As Pomyk says, try to use both autoloaders: http://www.php.net/manual/en/function.spl-autoload-register.php
Reneming classes is bad practice, because it's very difficult to update and feauture support
精彩评论