我有這個腳本,但它不工作,不知道如何解決它,請提供任何提示?我得到了另一端是字母 「t」簡單的隨機生成器腳本不工作
謝謝:)
<?php
$cachefile = './current_t_id';
$time = $id = null; // assume we have no cached quote
$change_every = 3600; // seconds
$pages = array(1 => 'text1-1.php', 2 => 'text1-2.php');
foreach($pages as $pagekey => $page){
if($pagekey == $siteId){
include($page);
}
}
// if cached quote exists, load it
if(is_file($cachefile)) {
list($time, $id) = explode(' ', file_get_contents($cachefile));
}
// if no cached quote or duration expired, change it
if(!$time || time() - $time > $change_every) {
srand ((double) microtime() * 100000);
$id = rand(0,count($page)-1);
file_put_contents($cachefile, time().' '.$id); // update cache
}
// echo the quote, be it cached or freshly picked
echo ($page[$id]);
?>
嘿錯誤的舉動。這是你的副本最後的帖子.. http://stackoverflow.com/questions/10011620/random-quotes-script-on-a-timer我不這是一個明智的舉動 – Baba 2012-04-04 15:07:09
這不是一個複製美食 – GibsonFX 2012-04-04 15:08:48
我已經添加了最後一篇文章中提出的建議,但我無法讓他們一起工作,所以我在尋求幫助,請不要在檢查事實之前指責我。 – GibsonFX 2012-04-04 15:10:09