閱讀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樹的研究