Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
假设在站点上加载了三行信息,并且在站点上,每次刷新页面时您只希望加载 3 行中的 1 行,因此它可能应该按随机或更好的方式排序。什么是最好的代码?
去做array_rand()
array_rand()
<?php $arr=array("Offer 1","Offer 2","Offer 3"); $val=array_rand($arr,1); echo $arr[$val];