cakephp 打印 sql 语句的代码
将以下语句复制到你的代码中,可以打印出在这之前所有的sql语句:
Copy to Clipboard引用的内容:
[www.veryhuo.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;