1

我在学校项目中使用 Laravel,最近发现了 PHPOffice 库。我在文档中找到了一些示例,但我仍然无法理解如何使用 Laravel 来处理它。用 composer 安装它,现在我想阅读一些 *.docx 文件。有人知道如何实现吗?我用这个

class ShareController extends Controller {
public function share($hashed_name){

    $ds = DIRECTORY_SEPARATOR;
    $userid = Auth::id();
    $name = basename(__FILE__, '.php');
    $source = storage_path('uploads\\'.$userid.'\\'.$onlyFilename.'_0.docx');
    echo date('H:i:s'), " Reading contents from `{$source}`", EOL;
    $phpWord = IOFactory::load($source);
    // Save file
    echo write($phpWord, basename(__FILE__, '.php'), $writers);
    if (!CLI) {
        include_once 'Sample_Footer.php';
    }

}

但我明白了

Whoops, looks like something went wrong.
1/1 ErrorException in ShareController.php line 34: Use of undefined constant EOL - assumed 'EOL' 
4

0 回答 0