请看这个页面 (演示页面已失效)
页面底部有“程序日志”显示
根据“程序日志”的显示,用最后一个时间减去第一个时间,可以算出大概是零点几秒,这是Yii的时间
另外,我修改了index.php文件,加上显示时间的代码,如下:
<?php
$stime=microtime(true); //获取程序开始执行的时间
// change the following paths if necessary
$yii=dirname(__FILE__).'/../framework/yii.php';
$config=dirname(__FILE__).'/protected/config/main.php';
// remove the following line when in production mode
defined('YII_DEBUG') or define('YII_DEBUG',true);
require_once($yii);
Yii::createWebApplication($config)->run();
echo "<br>";
//显示时间,这里显示的时间比Yii自身记录的时间大很多,一般是1点几秒
echo microtime(true).'-'.$stime.'=';
echo microtime(true)-$stime;
在我自己添加的代码中显示出页面执行时间是1点几秒,为什么Yii显示只有零点几秒,差这么多呢?