Load Zend Framework Component in Existing Project
I am new to PHP and very new to Zend Framework, so please give me a detailed answer.
I have Zend Server (including Zend Framework), Apache, MySql installed on the machine. I have a project created in Eclipse PDT (not with Zend Framework) and I've decided I want to use Zend_Db in my Data Acces Layer. I read many answers here and on other forums, I saw that I should use Zend_Loader but I am not really sure how to begin. I also saw that I need some php extension appropriate to the type of my database server.
As I said, please give me a detailed answer or a kick in the right direction.
Thanks
Later ed开发者_如何转开发it: I've just copied the required components in my project and included them and it works.
I ended up copying the Zend folder with the components I needed into a folder called Library and this is the way I instantiate the Autoloader, for example.
/* Define site root */
defined('DOCUMENT_ROOT') ? null : define('DOCUMENT_ROOT',realpath(dirname(__FILE__)));
defined('SITE_ROOT') ? null : define('SITE_ROOT',realpath(dirname(DOCUMENT_ROOT).'\mysite'));
$includePath[] = DOCUMENT_ROOT.'.';
$includePath[] = SITE_ROOT . '\Library';
$includePath[] = get_include_path();
$includePath = implode(PATH_SEPARATOR,$includePath);
set_include_path($includePath);
//Including Zend LoaderClass
require_once('Library/Zend/Loader/Autoloader.php');
//Loading the auto loader file.( Including the autoloader.php file)
$autoloader = Zend_Loader_Autoloader::getInstance();
精彩评论