drpjdfj618393 2010-12-11 19:07
浏览 32
已采纳

将自己的框架与PHP zend框架混合的更好方法

Recently I've started to use Zend framework next to my own framework. The solution at this moment for instance for the module "partner" having a rewrite condition in htaccess like

RewriteCond %{REQUEST_URI} ^./partner/?(.)
//redirect to build ZF
RewriteRule ^.*$ public/partner/index.php

// and the bootstrap files are

//index.php for Zend set_include_path(APPLICATION_PATH . '../../../library/php/');
include_once 'Zend/Loader/Autoloader.php';

//index.php for own framework set_include_path(get_include_path() . PATH_SEPARATOR . 'library/php/');

Is it possible to use Zend components just like it would with PEAR components?

Or the question with different perspective
Am I required to choose one of the two MVC patterns to go along with?

At the end I want to be able to use any library/framework for any module.

  • 写回答

1条回答 默认 最新

  • dongtou9934 2010-12-11 19:22
    关注

    You can use ZF components similar to PEAR stuff. The only thing you will need to do is set the include path so, that ZF's requires will function:

    set_include_path('path/to/library' . PATH_SEPARATOR . get_include_path())
    

    where path/to/library contains the Zend directory.

    At this point you can either initialize the ZF autoloader, or use require_once to load any classes you want to use.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 微带串馈天线阵列每个阵元宽度计算
  • ¥15 关于无人驾驶的航向角
  • ¥15 keil的map文件中Image component sizes各项意思
  • ¥30 BC260Y用MQTT向阿里云发布主题消息一直错误
  • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
  • ¥15 划分vlan后,链路不通了?
  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 Centos / PETGEM
  • ¥15 划分vlan后不通了