阅读789 返回首页    go 阿里云 go 技术社区[云栖]


magento -- 在Magento中获取SQL语句

       Magento是在Zend Framework的基础上搭建而来,有两种方式可以从Magento的collection获得真正的SQL语句。

 

以 Mage::getResourceModel('reports/product_collection') 为例:

 

1

         $collection=Mage::getResourceModel('reports/product_collection'); $collection->printlogquery(true); 

 

2

         $collection=Mage::getResourceModel('reports/product_collection'); $query=$collection->getSelectSql(true); echo $query; 

 

         可以看到同样的输出结果

         SELECT `e`.* FROM `catalog_product_entity` AS `e` 

最后更新:2017-04-02 06:51:17

  上一篇:go 2010 爆笑签名
  下一篇:go AVL树的研究