Laravel 4 SQL日志/控制台

编程入门 行业动态 更新时间:2024-10-23 18:24:43
本文介绍了Laravel 4 SQL日志/控制台的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

Laravel中是否有类似的东西可以让您看到正在执行的实际SQL? 例如,在Rails中,您可以在控制台中看到SQL.在Django中,您有一个工具栏.

Is there something similar in Laravel that allows you to see the actual SQL being executed? In Rails, for example, you can see the SQL in console. In Django you have a toolbar.

Laravel 4中有类似的东西吗?

Is there something like that in Laravel 4?

澄清一下:我的问题是如何在没有代码的情况下做到这一点.是否有Laravel内置的不需要我在应用程序中编写代码的东西?

To clarify: My question is how to do it without code. Is there something that is built-in in Laravel that does not require me to write code in app?

更新:最好我也希望看到CLI查询(例如php artisan migrate)

UPDATE: Preferably I'd like to see CLI queries as well (for example php artisan migrate)

推荐答案

如果您使用的是Laravel 4,请使用以下方法:

If you are using Laravel 4, use this:

$queries = DB::getQueryLog(); $last_query = end($queries);

更多推荐

Laravel 4 SQL日志/控制台

本文发布于:2023-10-27 15:59:51,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1533856.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:控制台   日志   Laravel   SQL

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!