學說2提供了日誌記錄一個簡單的界面,即\原則\ DBAL \日誌\ SQLLogger()
https://github.com/doctrine/dbal/blob/master/lib/Doctrine/DBAL/Logging/SQLLogger.php
$config = new Doctrine\ORM\Configuration();
// ... config stuff
$config->setSQLLogger(new \Doctrine\DBAL\Logging\EchoSQLLogger());
$connectionParams = array(
'dbname' => 'example',
'user' => 'example',
'password' => 'example',
'host' => 'localhost',
'driver' => 'pdo_mysql');
//make the connection through an Array of params ($connectionParams)
$em = EntityManager::create($connectionParams, $config);
對不起,這麼久來回答,我要感謝你的回答它幫助我很多!謝謝! –