带有1个结果的版本
<?php
srand();
$files = array("folder/content1.php", "folder/content2.php", "folder/content3.php", "folder/content4.php", "folder/content5.php", "folder/content6.php");
$rand = array_rand($files);
include ($files[$rand]);
?>包含5个结果的版本(由代码精神提供)
<?php
$files = array("folder/content1.php", "folder/content2.php", "folder/content3.php", "folder/content4.php", "folder/content5.php", "folder/content6.php");
foreach (array_rand($files, 5) as $file) {
include($files[$file]);
}
?>发布于 2022-09-18 17:03:01
你需要一个循环。
foreach (array_rand($files, 3) as $file) {
include($files[$file]);
}https://stackoverflow.com/questions/73764381
复制相似问题