Codeigniter and PHPWord

霸气de小男生 提交于 2019-12-23 09:27:01

问题


I'm trying to read some document. So I use PHPWord.

Here what i got in my library.

<?php
if ( ! defined('BASEPATH')) exit('No direct script access allowed');

require_once  APPPATH . '/third_party/PhpWord/Autoloader.php';
use PhpWord\Autoloader as Autoloader;
Autoloader::register();

class Word extends Autoloader {

}

when i'm going to use it. I have this error :

Fatal error: Class 'PhpOffice\PhpWord\Autoloader' not found in D:\xampp\htdocs\jdih\application\libraries\Word.php on line 6
A PHP Error was encountered

Severity: Error

Message: Class 'PhpOffice\PhpWord\Autoloader' not found

Filename: libraries/Word.php

Line Number: 6

Backtrace:

I have try this CodeIgniter PHPWord using as third_party but no help .

Here is the folder of my third_party. How can i fix the problem ?


回答1:


Download PHPWord from here

And load the library like this.

include_once(APPPATH."third_party/PhpWord/Autoloader.php");
//use PhpOffice\PhpWord\Autoloader;
//use PhpOffice\PhpWord\Settings;
Autoloader::register();
Settings::loadConfig();


来源:https://stackoverflow.com/questions/39104942/codeigniter-and-phpword

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!