【发布时间】:2019-03-06 14:07:42
【问题描述】:
我需要在我的应用程序中下载一个示例 .csv 文件。我在下面给出的控制器中使用 Code Igniter 框架我的函数
public function dwnEmp(){
$this->load->helper('download');
$path = file_get_contents(base_url('/application/modules/payroll/views/employee/sample_Employee_details.csv'));
force_download('sample_Employee_details.csv', $path);
}
每当我尝试下载它给我的文件时
消息:file_get_contents(): http:// 包装器在 通过 allow_url_fopen=0 配置服务器
我已经通过 multiphpini 在我的 cpannel 和 whm 中设置了 allow_url_fopen = 1,但在 php info 中它仍然显示 allow_url_fopen=1。我还重新启动了 apache 服务器,但问题仍然存在。
【问题讨论】:
-
也许可以试试 curl php.net/manual/en/curl.examples.php,大多数主机不像
fopen和include那样限制 curl。
标签: php codeigniter-3