我想改善php脚本的页面生成时间。但根据php探查器报告,这是一个大约需要0.9秒的echo语句
我在"CentOS release 5.6(Final)"机器中使用"php-5.3"。
下面是php代码--
<?php
$AllTimerDataValue = ClMiscellaneous::getAllActivityData();//returns an array of size maximum 40
$output = '<input type="hidden" name="actions" value="'.$_REQUEST['actions'].'">';
$output.= '<table id="gradient-style-dup" class="activity_stream_container_tbl" rules="all" align="center">';
$output.= ClMiscellaneous::getHtmlViewOfSingleActivity($AllTimerDataValue);//returns html code based on $AllTimerDataValue
$output.= '</table>';
echo $output; // This is taking around 0.9 sec
?>
为了进行评测,我使用firefox的"DBG-Bar"插件,在服务器端我使用php的DBG模块。
原因可能是您在服务器上使用调试器,我确信echo不会花费0.9秒
但是,您可能喜欢尝试print()而不是echo();