Codeigniter和PHPWord [英] Codeigniter and PHPWord

查看:101
本文介绍了Codeigniter和PHPWord的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试阅读一些文档。所以我用PHPWord。



这是我从图书馆得到的东西。

 <?php 
if(!defined('BASEPATH'))exit('不允许直接脚本访问');

require_once APPPATH。 ‘/third_party/PhpWord/Autoloader.php’;
使用PhpWord\Autoloader作为Autoloader;
Autoloader :: register();

类Word扩展了自动加载器{

}

当我要使用它时。我有此错误:

 致命错误:在D:\xampp中找不到类'PhpOffice\PhpWord\Autoloader' \htdocs\jdih\application\libraries\Word.php在第6行
遇到PHP错误

严重性:错误

消息:找不到类'PhpOffice\PhpWord\Autoloader'

文件名:libraries / Word.php

行号:6

回溯:

我已经尝试过

解决方案

从此处下载 PHPWord



并像这样加载库。

  include_once(APPPATH。  third_party / PhpWord / Autoloader.php); 
//使用PhpOffice\PhpWord\Autoloader;
//使用PhpOffice\PhpWord\Settings;
Autoloader :: register();
Settings :: loadConfig();


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 ?

解决方案

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();

这篇关于Codeigniter和PHPWord的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆