cakephp 打印 sql 語句的代碼
將以下語句復制到你的代碼中,可以打印出在這之前所有的sql語句:
Copy to Clipboard![烈火提示:點擊查看 Liehuo.Net Codes](https://www.aspphp.online/bianchen/UploadFiles_4619/201701/2017011718002685.gif)
引用的內容:[www.bkjia.com]
$sources = ConnectionManager::sourceList();
if (!isset($logs)):
$logs = array();
foreach ($sources as $source):
$db =& ConnectionManager::getDataSource($source);
if (!$db->isInterfaceSupported('getLog')):
continue;
endif;
$logs[$source] = $db->getLog();
endforeach;
endif;