【问题标题】:file_get_contents(): http:// wrapper is disabled in the server configuration by allow_url_fopen=0file_get_contents(): http:// wrapper 在服务器配置中被allow_url_fopen=0 禁用
【发布时间】: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 服务器,但问题仍然存在。

【问题讨论】:

标签: php codeigniter-3


【解决方案1】:

您好,您可能还需要从 apache 更新 mod 重写。请确保它已启用。

【讨论】:

    【解决方案2】:

    您需要编辑 php.ini 并启用以下 2 项设置。

    allow_url_fopen = 1

    allow_url_include = 1

    重新启动 Apache,它们应该得到修复。

    【讨论】:

    • 值将是 1 或 0,而不是开/关
    猜你喜欢
    • 2017-11-24
    • 1970-01-01
    • 2018-01-22
    • 1970-01-01
    • 2014-06-10
    • 1970-01-01
    • 2014-03-07
    相关资源
    最近更新 更多