【发布时间】:2018-09-29 19:15:54
【问题描述】:
我想随机显示 5 个 php 文件内容,但 不重复 当使用 php/javascript(也适用于 php 桌面)单击按钮 [NEXT] 时。
我使用的代码在页面加载时确实显示了随机网页,但我确实遇到了重复的网页
这是我用于 index.php 文件的代码:
<?php
$RandomList = array();
$RandomList[] = "/review/review-a1.php";
$RandomList[] = "/review/review-a2.php";
$RandomList[] = "/review/review-a3.php";
$RandomList[] = "/review/review-a4.php";
readfile($_SERVER['DOCUMENT_ROOT'].$RandomList[rand(0,count($RandomList)-1)]);
?>
请建议如何获取非重复文件。
【问题讨论】:
-
您能否详细说明一下,因为我是这些代码的新手!