參考連結:http://phpbb-tw.net/phpbb/viewtopic.php?p=119090#119090
使用版本:phpBB 2.0.20
網站位置:
狀況描述:
小弟使用該外掛來作為 banner 的隨機顯示,欲使用外連免費空間以免流量之虞,試著做了下列修改。
代碼: 選擇全部
#-----[ OPEN 打開 ]------------------------------------------
#
includes/page_header.php
#
#-----[ FIND 尋找 ]------------------------------------------
#
// Format Timezone. We are unable to use array_pop here, because of PHP3 compatibility
#
#-----[ ABOVE, ADD 上面加入 ]------------------------------------------
#
//
// Random images
//
mt_srand((double)microtime()*1000000);
$imgs = dir('images/random_img');
while ($file = $imgs->read()) {
if (eregi("gif", $file) || eregi("jpg", $file)) {
$imglist .= "$file ";
}
}
closedir($imgs->handle);
$imglist = explode(" ", $imglist);
$a = sizeof($imglist)-2;
$random = mt_rand(0, $a);
$image = $imglist[$random];
$content_img = "<img src=images/random_img/$image border='0' HSPACE='10' alt='Random images 隨機圖片'>";
// Random images $content_img = "<img src=http://xxxxxx.myweb.hinet.net/images/random_img/$image border='0' HSPACE='10' alt='Random images 隨機圖片'>";
結果圖片顯示 ok !圖片位置也為外連網址!
才想說成功了將原本放置主機內的 random_img 資料夾砍掉,但卻會造成 page_header.php 的錯誤,不知是否是底下這段影響的問題:
代碼: 選擇全部
$imgs = dir('images/random_img');還請各位前輩賜教,感激不盡!^__^
