【发布时间】:2016-05-11 03:07:24
【问题描述】:
嗨,我在使用文件处理方面非常新,所以我想做的是打开一个 docx 文件,然后将它放入我将在我的视图中显示的字符串中。我已经读过 PHP 文件处理已经在 php 的核心中,所以我想尝试将它集成到 laravel 4.2 中所以这是我的控制器
public function open($id)
{
$title = "Open files";
`
$smpl = DB::table('sfiles')
->where('fileid' , '=' , $id)
->get();
foreach($smpl as $file)
$fname = $file->filename;
$opendoc = file_get_contents('public/upload/docs/' . $fname);
return View::make('dmy.open_doc' , compact('title', 'smpl'));
}`
执行时,我有一个错误提示
file_get_contents(public/upload/docs/2016-05-11-10-09-55-ppd-jobdesc.docx): failed to open stream: No such file or directory
关于我做错了什么的任何想法?或者有什么想法可以改善我的逻辑?非常感谢
【问题讨论】:
标签: php laravel laravel-4 file-handling