phpsrand
发布时间: 2025-08-07 08:52:29
1. 我有一组微信号,每次刷新页面,随机显示一个微信号,怎样用php实现
php后台代码(命名为:houtai.php):
<?php
srand ((float) microtime() * 10000000);
$input = array ("wx1", "wx2", "wx3", "wx3");
$rand_keys = array_rand ($input);
//print $input[$rand_keys];
?>
前台代码(在前台展示页面,例如:index.php):
<span id="wxzs"><?php require_once 'houtai.php'; echo "$input[$rand_keys]";?></span>
主要利用随机数原理,可以参考这个网址:http://www.jb51.net/article/84856.htm
热点内容
