Jump to content
php.lv forumi

Cik sekundes ieladejas lapa?


Mikus

Recommended Posts

// Ieliec dokumenta aukšpusē
$startTime = round(microtime(), 3);

// Ieliec dokument beigās
$EndOfGeneration = round(microtime(), 3);

$generation = $startTime - $EndOfGeneration;

echo 'Lapa tika ģenerēta '.$generation.' sekundes';

Link to comment
Share on other sites

paldies tas piemers man palidzeja bet es veel tikai gribeju pajautat vai neav iespejams nedaudz saisinat so skaitli nu piemeram uz kadiem 6 cipariem nevis 16?

 

aa nee nevajag palidzet :D paldies!

 

<?php

function microtime_float()
{
  list($usec, $sec) = explode(" ", microtime());
  return ((float)$usec + (float)$sec);
}

$time_start = microtime_float();

usleep(100);

$time_end = microtime_float();
$time = $time_end - $time_start;

$laiks = substr($time,0,6);

echo "Lapa ieladejas $laiks sekundes\n";
?>

Edited by Mikus
Link to comment
Share on other sites

×
×
  • Create New...