PHP use关键字导致500服务器错误
我正在尝试实现PhpPresentation以转换一些文件,因此我有以下代码:PHP use关键字导致500服务器错误,php,namespaces,Php,Namespaces,我正在尝试实现PhpPresentation以转换一些文件,因此我有以下代码: use PhpOffice\PhpPresentation\src\PhpPresentation\PhpPresentation; use PhpOffice\PhpPresentation\src\PhpPresentation\IOFactory; use PhpOffice\PhpPresentation\src\PhpPresentation\Style\Color; use PhpOffice\PhpPr
use PhpOffice\PhpPresentation\src\PhpPresentation\PhpPresentation;
use PhpOffice\PhpPresentation\src\PhpPresentation\IOFactory;
use PhpOffice\PhpPresentation\src\PhpPresentation\Style\Color;
use PhpOffice\PhpPresentation\src\PhpPresentation\Style\Alignment;
由于某种原因,这段代码正是导致500个内部服务器错误的原因。我已将错误报告设置为“全部”,但未显示任何错误。路径是正确的,我的根目录中有PhpOffice文件夹(public_html)和相应的子文件夹
自动加载程序代码的加载方式如下:
require_once 'PhpOffice/PhpPresentation/src/PhpPresentation/Autoloader.php';
\PhpOffice\PhpPresentation\Autoloader::register();
require_once 'PhpOffice/src/Common/Autoloader.php';
\PhpOffice\Common\Autoloader::register();
由于此,问题已修复
我在一个函数中使用了“use”,这是错误的,也是错误的原因。请查看http服务器错误日志文件,在该文件中,您可以读取实际问题。最有可能的是,自动加载程序找不到这些定义。
语法错误,第一行出现意外的“use”
。以下是我的全部功能和一些想法:在use
行之前是否有任何行?可能是一个缺少代码>?确定一下……你的PHP版本是什么?好的,这意味着你的PHP版本很可能已经过时,并且低于5.6
。您想要升级。