在CakePHP中实现文件下载
来源:互联网 发布:java 多线程 回调函数 编辑:程序博客网 时间:2024/06/07 10:13
在View使用超链接直接指向文件
//文件路径:webroot/files/abc.docx$this->Html->link('下载文件', '/files/abc.docx');
在Controller设置Response类型
Cake\Http\Response::withFile(
//Send files as responses for your requests$resp = $this->response->withFile('files/abc.jpg');//Force a file to be downloaded instead of displayed in the browser$resp = $this->response->withFile('files/abc.docx', [ 'download' => true, 'name' => 'xyz.docx' //rename the file]);//Return the response to prevent controller from trying to render a viewreturn $resp;
阅读全文
0 0
- 在CakePHP中实现文件下载
- cakephp 文件下载
- CakePHP文件下载
- 如何在.net中实现文件下载
- 在PHP中怎样实现文件下载?
- 在Struts 2中实现文件下载
- 在CakePHP中使用swfObject
- cakephp: 在ide中执行cakephp test case
- 在SpringMVC框架中实现文件上传和下载
- Linux中执行CakePHP Shell文件
- cakephp: 在条件中使用sql函数
- [CakePHP] 在Controller中使用Helper
- CakePHP: 在控制器中动态切换数据库连接
- 在CakePHP项目中集成EasyWeChat
- 如何在CakePHP中使用Ajax请求
- cakephp中使用ckeditor+ckfinder实现在线编辑与文件上传.
- 在CakePHP 1.2 中实现多语言支持——i18n 和 L10n 的使用简述
- 在ASP.NET中实现压缩多个文件为.zip文件,实现批量下载功能
- 做一个简单的mvc封装
- Spring--8.aop
- Microsoft Excel 中 ROMAN 函数介绍
- php 自动加载
- 嵌入式Jetty开发之代码启动Jetty
- 在CakePHP中实现文件下载
- linux 下 tar 命令
- 转码
- typedef知识点 和 void* test(void*)这个函数作为参数的知识点
- sql脚本注释问题
- 系统虚拟机管理--镜像/快照安装,脚本修复
- java Annotation
- Android 7.0 GMS认证(一)
- js对象的深度克隆