CodeIgniter - force_download() no output

前端 未结 5 661
情深已故
情深已故 2021-02-06 07:37

Fast to explain, but I can\'t get it to work:

In this simple code, the function force_download simply doesn\'t make any output.

$this->load->helper         


        
5条回答
  •  死守一世寂寞
    2021-02-06 08:11

    This will work with you

    $this->load->helper('download');
    $path = file_get_contents(base_url()."modulos/".$filename); // get file name
    $name = "sample_file.pdf"; // new name for your file
    force_download($name, $path); // start download`
    

提交回复
热议问题