1
$isac_start = microtime(true);
function ilog($m) use ($isac_start){
$time_elapsed_secs = microtime(true) - $isac_start;
file_put_contents(__DIR__.'/debug_log.txt', $m . " - time elapsed: " . $time_elapsed_secs . "\n", FILE_APPEND | LOCK_EX);
}
給我
未定義的變量$isac_start
;
爲什麼?如何解決它?
我很確定PHP的'use'語法只對匿名函數有效。我不知道爲什麼會這樣;我發現令人不安的是,命名和匿名函數的處理方式如此不同...... – Chris