[thinkphp使用phpspreadsheet时出现]Cannot redeclare xxxxxx() (previously declared in C:WWWxxx.xxx:xxx) [thinkphp使用phpspreadsheet时出现]Cannot redeclare xxxxxx() (previously declared in C:WWWxxx.xxx:xxx)

一、总结

一句话总结:Cannot redeclare Complexabs() (previously declared in D:softwarecodephpStudy2018PHPTutorialWWWgithubm_Orchestratem_Orchestratevendormarkbakercomplexclassessrcfunctionsabs.php:26)

错误提示:

Cannot redeclare xxxxxx() (previously declared in C:WWWgeoip.inc:xxx) in <b>C:WWWgeoip.inc</b> on line <b>xxx</b><br />

错误原因:

这个问题是因为多次引用导致重复声明

 

解决方法:

1.看到报错的那个文件,这里是C:WWWgeoip.inc

2.搜索引用 geoip.inc 的文件,找到:require ("geoip.inc"); 这样子的语句,将其改为 require_once ("geoip.inc");

3.重新访问测试,只要还报错就说明还有地方没改好

1、我出现这样问题的原因:?

thinkphp里面其实已经默认帮我们把插件vendor里面的东西都加载进了系统,

而我在第七行中再加载一次,那么肯定会造成重复加载的问题

1 // [ 应用入口文件 ]
2 
3 // 定义应用目录
4 define('APP_PATH', __DIR__ . '/../application/');
5 // 加载框架引导文件
6 require __DIR__ . '/../thinkphp/start.php';
7 //require __DIR__ . '/../vendor/autoload.php';

二、[PHP问题]Cannot redeclare xxxxxx() (previously declared in C:WWWxxx.xxx:xxx)

版权声明:本文为博主原创文章,未经博主允许可以随意转载。 https://blog.csdn.net/Kingsley_zhong/article/details/46328465

今天碰到一个诡异的现象,用别人家的PHP程序报错,简单记录一下:

 

错误提示:

Cannot redeclare xxxxxx() (previously declared in C:WWWgeoip.inc:xxx) in <b>C:WWWgeoip.inc</b> on line <b>xxx</b><br />

错误原因:

这个问题是因为多次引用导致重复声明

 

解决方法:

1.看到报错的那个文件,这里是C:WWWgeoip.inc

2.搜索引用 geoip.inc 文件,找到:require ("geoip.inc"); 这样子的语句,将其改为 require_once ("geoip.inc");

3.重新访问测试,只要还报错就说明还有地方没改好

参考:[PHP问题]Cannot redeclare xxxxxx() (previously declared in C:WWWxxx.xxx:xxx) - 御风的博客 - CSDN博客
https://blog.csdn.net/kingsley_zhong/article/details/46328465