2017-07-15 44 views
0

如何使用UTF8字符路徑地址SCANDIR PHP如何使用UTF8字符路徑地址SCANDIR PHP

我的文件夾名稱爲:61تستتست

我有錯誤SCANDIR和DirectoryIterator。

更改文件夾名稱後修復我的問題,但需要全名。

$folder = '61-تست تست'; 
     $path = 'files/'.$folder; 

print_r(scandir($path)); 

     foreach (new \DirectoryIterator($path) as $file) { 
      if(!$file->isDir()) 
      { 
       echo $file->getFilename() . "<br>"; 
      } 
     } 

錯誤:在PHP 5.6 LINUX

UnexpectedValueException 

The system cannot find the file specified. (code: 2) 

DirectoryIterator::__construct(D:/wamp64/www/project/web/files/61-تست تست,D:/wamp64/www/project/web/files/61-تست تست): The system cannot find the file specified. (code: 2) 
+0

سلام。點擊下面的鏈接可以查看: https://stackoverflow.com/questions/22990072/scandir-in-php-with-special-hungarian-characters https://stackoverflow.com/questions/3544772/readdir-and -scandir بعدشگوگلروهمبگرد,حتماکسیبودهبااینمشکلبرخوردهباشه: https://www.google.com/search?sclient=psy-ab&q=utf8+Scandir+php&oq=utf8+Scandir+php&gs_l=serp 0.3 ... 90157.97443.0.100148.7.7.0.0.0.0.0.0..0.0 .... 0 ... 1.1.64.psy-ab..7.0.0.uRgxw9rYKHs&PBX = 1&BAV = on.2,或。 &biw = 1024&bih = 662&ech = 1&psi = 5YlqWfWOJ8PVwQLFzZnIDw.1500154339585.3&ei = 5YlqWfWOJ8PVwQLFzZnIDw&emsg = NCSR&noj = 1 موفقباشی – msoa

回答

0

SCANDIR不錯的工作,但上傳文件只能用FTP和PHP不工作5.6窗戶修復這個在windows你使用WFIO分機或升級到PHP 7.1