V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
• 请不要在回答技术问题时复制粘贴 AI 生成的内容
konakona
V2EX  ›  程序员

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

  •  
  •   konakona ·
    54853315 · Aug 9, 2014 · 4740 views
    This topic created in 4285 days ago, the information mentioned may be changed or developed.

    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 replies    2014-08-09 10:16:26 +08:00
    dawn009
        1
    dawn009  
       Aug 9, 2014
    我用DB自带的Log
    WildCat
        2
    WildCat  
       Aug 9, 2014 via iPhone
    Laravel debug bar
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2197 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 36ms · UTC 00:24 · PVG 08:24 · LAX 17:24 · JFK 20:24
    ♥ Do have faith in what you're doing.