phalcon常用语法
打印SQL
//在config/service.php中注册服务 $di->set( 'profiler', function () { return new \Phalcon\Db\Profiler(); }, true ); //在controller中输出如下代码 $profiles = $this->di->get('profiler')->getProfiles(); //遍历输出 foreach ($profiles as $profile) { echo "SQL语句: ", $profile->getSQLStatement(), "<br/>"; //echo "开始时间: ", $profile->getInitialTime(), "\n"; //echo "结束时间: ", $profile->getFinalTime(), "\n"; //echo "消耗时间: ", $profile->getTotalElapsedSeconds(), "\n"; } //最后语句 //echo $this->di->get('profiler')->getLastProfile()->getSQLStatement(); die;