首先要有一個支援PHP的空間 然後開一個檔案 副檔名為 .php 的 例如 image.php 用筆記本開啟 把以下程式碼貼到空白地方 並修改 然後上傳到空間上 Discuz!代碼 使用方法﹕ 如果要用在頭像 可填上 http://網址/檔名.php?其中一個圖檔的名字.副檔名 如果網址為 fpalw.org 檔名為 image.php 其中一個圖檔的名和副檔名為 Monsters13.jpg
程式碼如下﹕<?php /* 作者:別問我是誰,waterhk 修整:廢人一個(不懂我是誰/keihileon) */ $imgdir = 'image'; //圖片資料夾的位於,最尾不用加上'/'(斜號) $setimg = array(); $f = opendir($imgdir); while($files = readdir($f)) { if ($files != '..' && $files != '.' && preg_match("/(jpg|gif|png)$/i", $files)) { $setimg[] = $files; } } closedir($f); $m = count($setimg)-1; $num = rand(0, $m); $link = '/'.$imgdir.'/'.$setimg[$num]; header("Location: ".$link); ?>複製代碼
使用道具 舉報
本版積分規則 發表回復 回帖後跳轉到最後一頁
Archiver|手機版|小黑屋|免責聲明|TShopping
GMT+8, 2024-3-29 09:45 , Processed in 0.044384 second(s), 19 queries .
本論壇言論純屬發表者個人意見,與 TShopping綜合論壇 立場無關 如有意見侵犯了您的權益 請寫信聯絡我們。
Powered by Discuz! X3.2
© 2001-2013 Comsenz Inc.