當前位置:首頁 » 編程語言 » phpsrand

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

熱點內容
java返回this 發布:2025-10-20 08:28:16 瀏覽:585
製作腳本網站 發布:2025-10-20 08:17:34 瀏覽:881
python中的init方法 發布:2025-10-20 08:17:33 瀏覽:574
圖案密碼什麼意思 發布:2025-10-20 08:16:56 瀏覽:761
怎麼清理微信視頻緩存 發布:2025-10-20 08:12:37 瀏覽:677
c語言編譯器怎麼看執行過程 發布:2025-10-20 08:00:32 瀏覽:1005
郵箱如何填寫發信伺服器 發布:2025-10-20 07:45:27 瀏覽:250
shell腳本入門案例 發布:2025-10-20 07:44:45 瀏覽:108
怎麼上傳照片瀏覽上傳 發布:2025-10-20 07:44:03 瀏覽:799
python股票數據獲取 發布:2025-10-20 07:39:44 瀏覽:705