关于在Laravel4中记录SQL查询,已经有几个问题了,但是我几乎try 了所有的问题,它仍然不能以我想要的方式工作.
Here's my situation
- in my php view file, I make AJAX request to the server
-
接收AJAX请求并运行原始参数化的Postgres SQL查询(例如.
DB::select('select * from my_table where id=?', array(1))
如果我使用
Event::listen('illuminate.query', function($sql)
{
Log::error($sql);
});
I just get "select * from my_table where id=?" as the log message without the ID value actually populated.
如果我使用
$queries = DB::getQueryLog();
$last_query = end($queries);
Log::error(print_r($last_query, true));
I still don't have the final SQL query with the ID populated.
Finally, if I use a logging tool like https://github.com/loic-sharma/profiler - it doesn't display anything since I'm making an AJAX request.
Have I exhausted my options? Is there still another better way?