我有这个脚本,但它不起作用,不知道如何修复它,请问有什么提示吗?我从另一端得到的只是字母“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]);
?>