回声花费太多时间

时间:2011-06-24 10:51:03

标签: php profiler

我想改进php脚本的页面生成时间。 但是根据php profiler报告,这是一个大约需要0.9秒的回声声明。

我在“CentOS 5.6(最终版)”机器中使用“ 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模块。

1 个答案:

答案 0 :(得分:0)

原因可能是你在服务器上使用调试器,我确信这样的回声不会花费0.9秒。

但是你可能想尝试print()而不是echo();