问题
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