V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
konakona
V2EX  ›  程序员

说吧,你用 laravel4 的时候是怎么查看最后一条执行的 sql 的

  •  
  •   konakona ·
    54853315 · 2014-08-09 01:48:21 +08:00 · 4227 次点击
    这是一个创建于 3559 天前的主题,其中的信息可能已经有所发展或是发生改变。

    http://stackoverflow.com/questions/14536165/get-the-query-executed-in-laravel-3-4

    public static function q($all = true)
    {
        $queries = DB::getQueryLog();
    
        if ($all == false) {
            $last_query = end($queries);
            return $last_query;
        }
    
        return $queries;
    }
    

    没用 空array,来点方便的方法吧!

    3 条回复    2014-08-09 10:16:26 +08:00
    dawn009
        1
    dawn009  
       2014-08-09 05:07:28 +08:00
    我用DB自带的Log
    WildCat
        2
    WildCat  
       2014-08-09 08:43:27 +08:00 via iPhone
    Laravel debug bar
    WildCat
        3
    WildCat  
       2014-08-09 10:16:26 +08:00
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3692 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 32ms · UTC 04:54 · PVG 12:54 · LAX 21:54 · JFK 00:54
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.