我正在运行这个文件:
$file_name = "WEL_log_".date('Y_m');
$url = 'http://www.welserver.com/WEL0521/'.$file_name.'.xls';
$base_path = '/Applications/XAMPP/xamppfiles/htdocs/website/';
$tmp_path = $base_path.'tmp_'.$file_name.'.tsv';
$path = $base_path.$file_name.'.tsv';
$current_month_path = $base_path.'current_month.tsv';
$latest_path = $base_path.'latest.tsv';
function downloadFile ($url, $path) {
global $latest_path;
global $tmp_path;
global $current_month_path;
global $base_path;
$newfname = $tmp_path;
$file = fopen ($url, "rb");
if ($file) {
下面的行是编码中的第 37 行:
$newf = fopen ($newfname, "wb");
if ($newf){
while(!feof($file)) {
fwrite($newf, fread($file, 1024 * 8 ), 1024 * 8 );
}
}
}
if ($file) {
fclose($file);
}
if ($newf) {
copy($tmp_path, $current_month_path);
rename($tmp_path, $path);
fclose($newf);
write_latest_data($path, $latest_path);
}
}
function write_latest_data($read_file_path, $write_file_path, $no_of_new_lines=10){
$file = file($read_file_path);
$write_f = fopen ($write_file_path, "wb");
$line_count = count($file) > $no_of_new_lines ? $no_of_new_lines : count($file);
if ($write_f){
fwrite($write_f, $file[0], 1024 * 8 );
$file = array_reverse($file);
for($i=0; $i < $line_count; $i++){
fwrite($write_f, $file[$i], 1024 * 8 );
}
fclose($write_f);
}
并收到此警告
警告:fopen(/Applications/XAMPP/xamppfiles/htdocs/website/tmp_WEL_log_2013_08.tsv):无法打开流:/Applications/XAMPP/xamppfiles/htdocs/website/download.php 第 37 行的权限被拒绝
请告诉我我做错了什么?