| 网站首页 | 建站学院 | 资源下载 | 建站教程 | 图片素材 | 网贝社区 | 
您现在的位置: 网贝建站 >> 建站学院 >> PHP技术 >> php技巧 >> 正文 用户登录 新用户注册
专 题 栏 目
最 新 热 门
最 新 推 荐
相 关 文 章
没有相关文章
PHP应用程序的性能优化         
PHP应用程序的性能优化
作者:刘彦青 文章来源:网海之贝 点击数: 更新时间:2004-8-16 19:36:24

  $bench = new Benchmark_Timer; $bench->start();
  $bench->setMarker(\'Start of the script\'); 现在处于睡眠状态几分钟
  sleep(5); $bench->stop(); // 从计时器中获得分析信息
  print_r($bench->getProfiling());
?>

  $dsn = array(
  \'phptype\' => \'mysql\',
  \'hostspec\' => \'localhost\',
  \'database\' => \'database_name\',
  \'username\' => \'user_name\',
  \'password\' => \'password\'
  );
  $dbh = DB::connect($dsn); function getCreatedDate($id)
  {
  global $dbh; >$stmt = \"SELECT created_date FROM users WHERE id=$id\";
  // 在这里使用PEAR::DB
  $created_date = $dbh->getOne($stmt);
  if ((PEAR::isError($created_date)) ||
  (empty($created_date))) {
  return false;
  } else {
  return $created_date;
  }
  }include_once \'Benchmark/Iterate.php\';
  $bench = new Benchmark_Iterate; // 运行getDate函数10次
  $bench->run(10, \'getCreatedDate\', 1);// 打印分析信息
  print_r($bench->get());
  ?>

文章录入:admin    责任编辑:admin 
  • 上一篇文章:

  • 下一篇文章:
  • 【字体: 】【发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口
      网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!)