cakephp 打印 sql 语句的代码
程序员文章站
2024-02-19 16:23:04
...
cakephp 打印 sql 语句的代码
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;
将以下语句复制到你的代码中,可以打印出在这之前所有的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;