嗨,我有這個基本的隨機引用腳本,但我希望它在一個數組中輸出頁面,而不是「echo $ quote」,做一些數組與「包括('text.php,text2.php, text3.php');」等等。隨機引用定時器上的腳本?
不太確定該怎麼做。有任何想法嗎?
我也想定時器成爲突出的選擇功能,所以它從列表中選擇循環,而不是隨機抽取。
謝謝:)
<?php
$cachefile = './current_t_id';
$time = $id = null;
$change_every = 3600;
include('text.php');
if(is_file($cachefile)) {
list($time, $id) = explode(' ', file_get_contents($cachefile));
}
if(!$time || time() - $time > $change_every) {
srand ((double) microtime() * 100000);
$id = rand(0,count($quotes)-1);
file_put_contents($cachefile, time().' '.$id); // update cache
}
echo ($quotes[$id]);
?>
包含的文件包含哪些內容? – Baba 2012-04-04 13:12:37
只是html頁面 – GibsonFX 2012-04-04 13:26:59
你已經給了一個解決方案..這是你說的感謝你..你還想要什麼?你應該做的是接受或更新你的問題,你需要更多 – Baba 2012-04-04 15:26:13