• 请不要在回答技术问题时复制粘贴 AI 生成的内容
konakona
V2EX  ›  程序员

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

  •  
  •   konakona ·
    54853315 · Aug 9, 2014 · 4760 views
    This topic created in 4295 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   ·   1035 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 71ms · UTC 18:32 · PVG 02:32 · LAX 11:32 · JFK 14:32
    ♥ Do have faith in what you're doing.