Home > php教程 > php手册 > cakephp打印sql语句的方法,cakephpsql语句

cakephp打印sql语句的方法,cakephpsql语句

WBOY
Release: 2016-06-13 09:14:27
Original
1562 people have browsed it

cakephp打印sql语句的方法,cakephpsql语句

本文实例讲述了cakephp打印sql语句的方法。分享给大家供大家参考。具体实现方法如下:

将以下语句复制到你的代码中,可以打印出在这之前所有的sql语句:

$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;
Copy after login

希望本文所述对大家基于cakePHP框架的php程序设计有所帮助。

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template