cakephp 打印 sql 語句的代碼
將以下語句復制到你的代碼中,可以打印出在這之前所有的sql語句:
Copy to Clipboard引用的內容:[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;