嗨,我有这个基本的随机引用脚本,但我希望它在一个数组中输出页面,而不是“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