现在的位置: 首页 > 综合 > 正文

Using Zend Framework with CodeIgniter

2013年01月01日 ⁄ 综合 ⁄ 共 2978字 ⁄ 字号 评论关闭
文章目录

If you ever wanted to integrate CodeIgniter and Zend Framework, you might have come across this tutorial by Daniel Vecchiato.

Whilst Daniel has done a great job demonstrating the possibility of using the two frameworks together, concerns have been made: do we actually need to use hooks?

As I understand it, hooks are used to extend the core functionalities of CodeIgniter (as explained in the user guide). Obviously Zend Framework and CodeIgniter are two different systems and there is no intention for us to extend CodeIgniter’s core functionality with Zend Framework.

Using hooks can be dangerous as it’s system-wide, and it modifies the system behaviour.

What I have done is to simply use CodeIgniter’s library structure to load the Zend Framework resources. Below is the tutorial.

 

Assuming you already have CodeIgniter installed. If not please refer to the user guide for installation.

  1. Download Zend Framework from the official website.
  2. Unzip the Zend Framework package, and copy the Zend folder (under Library) to your CodeIgniter installation’s application/libraries/. You can actually place the folder anywhere, but remember to alter the script accordingly (read the comments in the script!).
  3. Place the library script (provided at the end of the post) in application/libraries/
  4. Done! That’s all you need to do. Now, let us see an example of using the library.

Usage Sample

Library Script

Copy the code and paste it to a new file called Zend.php in application/libraries/.

Happy coding! Oh and don’t forget, Zend Framework is PHP 5 only, so it won’t work on your PHP 4 installation.

抱歉!评论已关闭.