Re: [請益] 存取 Windows 上的中文檔案
如果只是要讀取的話, 可以用開啟HTTP遠端檔案配合urlencode的方式去做,
$fp = fopen("http://localhost/" . urlencode ("測試酶.txt"), "r");
echo fread($fp, 1024);
fclose($fp);
如果要寫入的話, 可以考慮透過FTP繞一下,
$file = 'tmp.txt';
$remote_file = '測試酶.txt';
$fp = fopen("http://localhost/" . $remote_file, "r");
$fp2 = fopen($file, "w");
$content = fread($fp, 1024);
$content .= "測試酶測試酶";
fwrite($fp2, $content);
fclose($fp);
fclose($fp2);
$ftp_server = "localhost";
$ftp_user = "id";
$ftp_pass = "pw";
$conn_id = ftp_connect($ftp_server) or die("Couldn't connect to $ftp_server");
if (@ftp_login($conn_id, $ftp_user, $ftp_pass))
if (ftp_put($conn_id, $remote_file, $file, FTP_ASCII))
//echo "successfully uploaded $file\n";
ftp_close($conn_id);
@unlink($file);
不知道有沒有更好的解法
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 118.169.76.176
討論串 (同標題文章)
完整討論串 (本文為第 6 之 6 篇):