gpt4 book ai didi

php - Codeigniter/PHPExcel 中无法重新声明 Excel 类错误

转载 作者:行者123 更新时间:2023-12-03 02:20:24 25 4
gpt4 key购买 nike

我想导出 Excel 文件中的一些数据,但出现此错误。

A PHP Error was encounteredSeverity: Compile Error

Message: Cannot redeclare class Excel

Filename: libraries/EXcel.php

Line Number: 9

我尝试了一些方法,但没有人适合我的情况。像1 2

这是我的EXcel.php代码

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

require_once APPPATH."third_party/PHPExcel/PHPExcel.php";
// var_dump(get_declared_classes());
class Excel extends PHPExcel {
public function __construct() {
parent::__construct();
}
}
?>

出了什么问题,谢谢。

这是我的 Var_dump 结果:

array (size=205)
0 => string 'stdClass' (length=8)
1 => string 'Exception' (length=9)
2 => string 'ErrorException' (length=14)
3 => string 'Closure' (length=7)
4 => string 'Generator' (length=9)
5 => string 'DateTime' (length=8)
6 => string 'DateTimeImmutable' (length=17)
7 => string 'DateTimeZone' (length=12)
8 => string 'DateInterval' (length=12)
9 => string 'DatePeriod' (length=10)
10 => string 'LogicException' (length=14)
11 => string 'BadFunctionCallException' (length=24)
12 => string 'BadMethodCallException' (length=22)
13 => string 'DomainException' (length=15)
14 => string 'InvalidArgumentException' (length=24)
15 => string 'LengthException' (length=15)
16 => string 'OutOfRangeException' (length=19)
17 => string 'RuntimeException' (length=16)
18 => string 'OutOfBoundsException' (length=20)
19 => string 'OverflowException' (length=17)
20 => string 'RangeException' (length=14)
21 => string 'UnderflowException' (length=18)
22 => string 'UnexpectedValueException' (length=24)
23 => string 'RecursiveIteratorIterator' (length=25)
24 => string 'IteratorIterator' (length=16)
25 => string 'FilterIterator' (length=14)
26 => string 'RecursiveFilterIterator' (length=23)
27 => string 'CallbackFilterIterator' (length=22)
28 => string 'RecursiveCallbackFilterIterator' (length=31)
29 => string 'ParentIterator' (length=14)
30 => string 'LimitIterator' (length=13)
31 => string 'CachingIterator' (length=15)
32 => string 'RecursiveCachingIterator' (length=24)
33 => string 'NoRewindIterator' (length=16)
34 => string 'AppendIterator' (length=14)
35 => string 'InfiniteIterator' (length=16)
36 => string 'RegexIterator' (length=13)
37 => string 'RecursiveRegexIterator' (length=22)
38 => string 'EmptyIterator' (length=13)
39 => string 'RecursiveTreeIterator' (length=21)
40 => string 'ArrayObject' (length=11)
41 => string 'ArrayIterator' (length=13)
42 => string 'RecursiveArrayIterator' (length=22)
43 => string 'SplFileInfo' (length=11)
44 => string 'DirectoryIterator' (length=17)
45 => string 'FilesystemIterator' (length=18)
46 => string 'RecursiveDirectoryIterator' (length=26)
47 => string 'GlobIterator' (length=12)
48 => string 'SplFileObject' (length=13)
49 => string 'SplTempFileObject' (length=17)
50 => string 'SplDoublyLinkedList' (length=19)
51 => string 'SplQueue' (length=8)
52 => string 'SplStack' (length=8)
53 => string 'SplHeap' (length=7)
54 => string 'SplMinHeap' (length=10)
55 => string 'SplMaxHeap' (length=10)
56 => string 'SplPriorityQueue' (length=16)
57 => string 'SplFixedArray' (length=13)
58 => string 'SplObjectStorage' (length=16)
59 => string 'MultipleIterator' (length=16)
60 => string 'ReflectionException' (length=19)
61 => string 'Reflection' (length=10)
62 => string 'ReflectionFunctionAbstract' (length=26)
63 => string 'ReflectionFunction' (length=18)
64 => string 'ReflectionParameter' (length=19)
65 => string 'ReflectionMethod' (length=16)
66 => string 'ReflectionClass' (length=15)
67 => string 'ReflectionObject' (length=16)
68 => string 'ReflectionProperty' (length=18)
69 => string 'ReflectionExtension' (length=19)
70 => string 'ReflectionZendExtension' (length=23)
71 => string 'SessionHandler' (length=14)
72 => string '__PHP_Incomplete_Class' (length=22)
73 => string 'php_user_filter' (length=15)
74 => string 'Directory' (length=9)
75 => string 'ZipArchive' (length=10)
76 => string 'LibXMLError' (length=11)
77 => string 'DOMException' (length=12)
78 => string 'DOMStringList' (length=13)
79 => string 'DOMNameList' (length=11)
80 => string 'DOMImplementationList' (length=21)
81 => string 'DOMImplementationSource' (length=23)
82 => string 'DOMImplementation' (length=17)
83 => string 'DOMNode' (length=7)
84 => string 'DOMNameSpaceNode' (length=16)
85 => string 'DOMDocumentFragment' (length=19)
86 => string 'DOMDocument' (length=11)
87 => string 'DOMNodeList' (length=11)
88 => string 'DOMNamedNodeMap' (length=15)
89 => string 'DOMCharacterData' (length=16)
90 => string 'DOMAttr' (length=7)
91 => string 'DOMElement' (length=10)
92 => string 'DOMText' (length=7)
93 => string 'DOMComment' (length=10)
94 => string 'DOMTypeinfo' (length=11)
95 => string 'DOMUserDataHandler' (length=18)
96 => string 'DOMDomError' (length=11)
97 => string 'DOMErrorHandler' (length=15)
98 => string 'DOMLocator' (length=10)
99 => string 'DOMConfiguration' (length=16)
100 => string 'DOMCdataSection' (length=15)
101 => string 'DOMDocumentType' (length=15)
102 => string 'DOMNotation' (length=11)
103 => string 'DOMEntity' (length=9)
104 => string 'DOMEntityReference' (length=18)
105 => string 'DOMProcessingInstruction' (length=24)
106 => string 'DOMStringExtend' (length=15)
107 => string 'DOMXPath' (length=8)
108 => string 'PDOException' (length=12)
109 => string 'PDO' (length=3)
110 => string 'PDOStatement' (length=12)
111 => string 'PDORow' (length=6)
112 => string 'SimpleXMLElement' (length=16)
113 => string 'SimpleXMLIterator' (length=17)
114 => string 'XMLReader' (length=9)
115 => string 'XMLWriter' (length=9)
116 => string 'CURLFile' (length=8)
117 => string 'COMPersistHelper' (length=16)
118 => string 'com_exception' (length=13)
119 => string 'com_safearray_proxy' (length=19)
120 => string 'variant' (length=7)
121 => string 'com' (length=3)
122 => string 'dotnet' (length=6)
123 => string 'finfo' (length=5)
124 => string 'GMP' (length=3)
125 => string 'Collator' (length=8)
126 => string 'NumberFormatter' (length=15)
127 => string 'Normalizer' (length=10)
more elements...

最佳答案

Excel 类已在您的项目中声明。

请将 Controller 的文件名和类名更改为不同的名称。我希望这能解决您的问题。

关于php - Codeigniter/PHPExcel 中无法重新声明 Excel 类错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54142404/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com