文件的下載的接口
// http://localhost/jiaxiao2/admin.php/Appstucoa/download/?File=F:/2.txt"
public function download(){
$file =I('File'); // 上傳文件保存路徑
if(is_file($file)) {
header("Content-Type: application/txt");
header("Content-Disposition: attachment; filename=".basename($file));
readfile($file);
}else{
$json['info'] = 'fail';
$json['status'] = C('STATUS_FAIL');
}
echo json_encode($json);
}
}
public function download(){
$file =I('File'); // 上傳文件保存路徑
if(is_file($file)) {
header("Content-Type: application/txt");
header("Content-Disposition: attachment; filename=".basename($file));
readfile($file);
}else{
$json['info'] = 'fail';
$json['status'] = C('STATUS_FAIL');
}
echo json_encode($json);
}
}
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.