dsij89625 2011-01-20 23:51
浏览 34
已采纳

如何启动Zend_Db_Select对象?

Hey guys, I'm having truble figuring this out: how do I initiate a zend_Db_Select object with the resources from my application.ini?

$db = Zend_Registry::get('db'); $select = $db->select();

But it's not working, I guess I have to add db to the registry first or something? Not sure how to do that though. Any ideas? I have my database details in application.ini

  • 写回答

1条回答 默认 最新

  • dqwh0108 2011-01-21 00:51
    关注

    You can only get objects from the registry which have been set before. So

    $db = Zend_Registry::get('db'); $select = $db->select();

    will return null, not an db adapter. You can initialize the adapter via the bootstrap. Read:

    http://framework.zend.com/manual/en/zend.application.theory-of-operation.html hxxp://www.zendframework.com/manual/en/zend.application.available-resources.html

    For the initialization of the db adapter (which is done by the bootstrap resource plugin for you) read:

    hxxp://framework.zend.com/manual/en/zend.db.adapter.html

    I wouldn't recommend using the registry at all, it is better to get the resources from the bootstrap.

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

报告相同问题?

悬赏问题

  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 下图接收小电路,谁知道原理
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测