看板 PHP 關於我們 聯絡資訊
各位版友大家好, 最近碰上一個問題就是 我需要讀取大量txt檔的php網頁 我目前碰到的問題就是 用dir 把檔案夾內的txt檔都呼叫出來 但是用下面那個方法呼叫,出來的檔名都會多出2個點 . 這樣變成我無法用fopen呼叫它做更進一步寫入資料庫, 不知道這樣的狀況該如何處理? 還有一個問題是,fopen是不是無法開啟中文檔名, 如果檔案夾內都是數字加中文檔名,請問該如何處理!!? PS 我目前單用數字英文檔名測試都OK 感謝各位了!! $dir = dir("C:/AppServ/www/test/data"); while (($file = $dir->read()) !== false) { /*read file*/ /* $uploaddir = 'C:/AppServ/www/test/data/'."$file"; $handle = fopen("$uploaddir","r"); } -- -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 114.32.103.198
appleboy46:把 . 跟 .. 過濾就可以了 09/03 19:30
cspy:你需要的是SQL語法~ 09/04 01:28
cspy:但是TXT要是UTF的文件 09/04 01:28
cspy:load data local infile 'txtfile' into table table1 09/04 01:30
cspy:文件內容需要有分隔記號 , 09/04 01:30
cspy:fields terminated by ","; 09/04 01:31