Toggle main menu visibility
新聞
下載
教材
影音
討論
其他選單
好站連結
行事曆
電子相簿
常見問題
萬用表單
即時留言簿
友站消息
社大學員
:::
登入
登入
帳號
密碼
登入
重整畫面
:::
所有書籍
「[991]PHP網站開發 進階應用技巧2」目錄
MarkDown
7. PHP檔案操作(上)
1. 網頁多媒體
2. Superfish下拉選單
2-1 index.php(遞迴範例)
3. 連動選單
3-1 menu1.php
3-2 menu2.php
3-3 menu1.php(索引與值都相同的精簡寫法)
3-4 demo/index.php
4. 表格內容排序
4-1 index.php
5. 拉動表格進行排序
5-1 index.php
5-2 checkbox.html
6. 即時聊天系統
6-1 index.php
7. PHP檔案操作(上)
7-1 index.php
7-2 iconize_l.css
8. PHP檔案操作(下)
8-1 index.php
8-2 index.php 中文目錄修正
9. 相片EXIF資訊及上傳
9-1 index.php
10. 目錄管理及相片特效
10-1 index.php
10-2 exif.php
11. 多媒體RSS
11-1 index.php
11-2 mrss.php
12. 樹狀目錄+HTML5
12-1 index.php
12-2 dtree.js
13. DHX入門(上)
13-1 index.php
13-2 index2.php
13-3 index3.php
13-4 index4.php
14. DHX編輯器及選單
14-1 index.php
14-2 input.php
14-3 setup.php
14-4 list.php
14-5 view.php
14-6 menu.xml
15. 點擊編輯
15-1 index.php
15-2 save.php
16. curl網頁採集
16-1 index.php
16-2 test1.php
17. 讀取RSS
17-1 index.php
18. 無刷新登入
18-1 index.php
18-2 login.php
18-3 index.php(AJAX版)
18-4 login.php(AJAX版)
7-2 iconize_l.css
\[991\]PHP網站開發 進階應用技巧2 ====================== <?php
if(!empty($\_GET\['to'\])){ define("\_UPLOAD\_DIR",$\_GET\['to'\]); }else{ define("\_UPLOAD\_DIR","D:/xampplite/htdocs/07/test/uploads"); }
define("\_UPLOAD\_URL","http://localhost/07/test/uploads"); $dh=opendir(\_UPLOAD\_DIR); $main="<table class='tinytable'> <tr><th>檔名</th><th>大小</th><th>類型</th></tr>"; while($file=readdir($dh)){ if($file==".")continue; $type=filetype(\_UPLOAD\_DIR."/".$file);
if($type=="dir"){
$dir\_arr
\[\]=$file; }else{
$file\_arr
\[\]=$file; }
} //秀出目錄
foreach(
$dir\_arr
as $sub\_dir){
$size=
($sub\_dir=="..")?"":
dirSize(\_UPLOAD\_DIR."/".$sub\_dir); $size=
($sub\_dir=="..")?"":
formatBytes($size,1); $sub\_dir=mb\_convert\_encoding($sub\_dir, "UTF-8", "Big5,UTF-8");
$main.= "<tr><td>
<a href='index.php?to=".\_UPLOAD\_DIR."/".$sub\_dir."'>$sub\_dir</a>
</td><td>$size</td><td>目錄</td></tr>"; } //秀出檔案 foreach(
$file\_arr
as $file){ $size=filesize(\_UPLOAD\_DIR."/".$file);
$size=formatBytes($size,1); $file=mb\_convert\_encoding($file, "UTF-8", "Big5,UTF-8");
$main.= "<tr><td><a href='".\_UPLOAD\_URL."/{$file}'>$file</a></td><td>$size</td><td>檔案</td></tr>"; }
$main.="</table>"; ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title></title> <link rel="stylesheet" href="tinytable.css" /> <link rel="stylesheet" href="iconize\_l.css" /> </head> <body> <?php echo $main;?> </body> </html>
<?php //計算目錄大小 function dirSize($directory) { $size = 0; foreach(new RecursiveIteratorIterator(new RecursiveDirectoryIterator($directory)) as $file){ $size+=$file->getSize(); } return $size; } //把 bytes 轉換成其他單位 function formatBytes($bytes, $precision = 2) { $units = array('B', 'KB', 'MB', 'GB', 'TB'); $bytes = max($bytes, 0); $pow = floor(($bytes ? log($bytes) : 0) / log(1024)); $pow = min($pow, count($units) - 1); $bytes /= pow(1024, $pow); return round($bytes, $precision) . ' ' . $units\[$pow\]; } ?>
:::
搜尋
search
進階搜尋
QR Code 區塊
快速登入
所有討論區
「PHP全端開發」線上課程討論區
XOOPS使用討論區
一般研習學員
社大學員專用
路過哈啦區
XOOPS佈景設計
XOOPS模組開發
Tad書籍區
即時留言簿
書籍目錄
展開
|
闔起
線上使用者
88
人線上 (
35
人在瀏覽
線上書籍
)
會員: 0
訪客: 88
更多…