0
我想知道是否有可能输出学说的错误,一个相当于是这样的:学说查询错误报告
模具(mysql_error());
我在问,因为没有保存数据,但没有返回错误的表单脚本。我不知道教义在幕后做了什么。
非常感谢 Ĵ
我想知道是否有可能输出学说的错误,一个相当于是这样的:学说查询错误报告
模具(mysql_error());
我在问,因为没有保存数据,但没有返回错误的表单脚本。我不知道教义在幕后做了什么。
非常感谢 Ĵ
class FileSqlLogger implements Doctrine\DBAL\Logging\SQLLogger {
private $log_dir = '/var/www/logs/Doctrine/queries';
public function startQuery($sql, array $params = null, array $types = null)
{
$now = new DateTime;
$file_name = "{$this->log_dir}/{$now->format('d-m-Y')}.log";
if (is_writable($this->log_dir))
{
file_put_contents($file_name, "{$now->format('H:i:s')}: Executing query '{$sql}' with parameters " . implode(', ', $params));
}
else
{
die('Error: Unable to write to the Doctrine log file!');
}
}
}
我没有测试过这一点,我不知道是否会工作,但我认为它应该帮助你在正确的方向。
Logging Doctrine错误。
也许可以提供帮助。
如何使用[SQL Logger](http://docs.doctrine-project.org/projects/doctrine-orm/en/2.0.x/reference/configuration.html#sql-logger-optional)? – manix
哪个版本的教义? – j0k