我想提高php脚本的页面生成时间。但是,根据php分析器报告,它是echo语句,花费了大约0.9秒。
我在一个“版本5.6 (最终)”机器上使用"CentOS 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“插件,而在服务器端,我使用的是php的DBG模块。
发布于 2011-07-11 10:55:18
这可能是因为您在服务器上使用调试器,我可以肯定的是,echo不会花费0.9秒。
但是,您可能希望尝试print()而不是echo();
https://stackoverflow.com/questions/6466756
复制相似问题