在我的 CODEIGNITER 项目之一中,我有以下运行良好的代码:
$this->output
->set_content_type('application/pdf')
->set_output(file_get_contents($file));
Run Code Online (Sandbox Code Playgroud)
为了使代码内存友好,我想使用 php 函数readfile()代替file_get_contents()但它不能正常工作。
我注意到 readfile() 可以在我返回图像但不适用于PDF 时工作。
我怎么能做到这一点?
我安装了 Codeigniter 4.0.2 并做了以下更改:
1-CI_ENVIRONMENT = development在 .env 文件中
2-SetEnv CI_ENVIRONMENT development在公用文件夹中的 .htaccess
3-$useKint = true;在公共文件夹中的主 index.php 文件中添加
当我在本地主机上打开时,会呈现欢迎页面,但不会呈现任何调试工具栏。我错过了什么吗?