douxie7339 2017-05-02 09:48
浏览 33
已采纳

PHP使用关键字导致500服务器错误

I'm trying to implement PhpPresentation to convert some files, so I have the following code:

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;

For some reason exactly this piece of code is causing 500 Internal server error. I have error reporting set to all, but no errors are shown. The path is right, i have the PhpOffice folder in my root directory(public_html) and the corresponding subfolders too.

autoloader code is loaded this way:

require_once 'PhpOffice/PhpPresentation/src/PhpPresentation/Autoloader.php';
  \PhpOffice\PhpPresentation\Autoloader::register();
  require_once 'PhpOffice/src/Common/Autoloader.php';
  \PhpOffice\Common\Autoloader::register();
  • 写回答

1条回答 默认 最新

  • dousi2029 2017-05-02 10:20
    关注

    Issue fixed, thanks to this https://stackoverflow.com/a/33355711/7926703

    I was using 'use' inside a function which is wrong and error-causing.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 c程序不知道为什么得不到结果
  • ¥40 复杂的限制性的商函数处理
  • ¥15 程序不包含适用于入口点的静态Main方法
  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置