enter code here
$loadMessageDisplayed = FALSE;
function file_get_contents_curl($url){
global $loadMessageDisplayed;
$ch = curl_init();
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
$data = curl_exec($ch);
//PAGE LOAD TIME
if(!curl_errno($ch) && !$loadMessageDisplayed){
$cinfo = curl_getinfo($ch);
echo 'Page loaded in '.$cinfo['total_time'].' seconds';
$loadMessageDisplayed = TRUE;
}
curl_close($ch);
return $data;
}
我只想顯示頁面加載時間一次。再次,如果我調用相同的功能,它不應該顯示我加載時間。如何僅打印頁面加載時間一次
你叫什麼疑問或問題? –
我無法顯示在相關領域的加載時間(段劃分 - >
當你說「只有一次」你真的是隻有一次或者是一次每個會話,一旦每X MINUES或別的東西 – daker