【发布时间】:2019-03-08 06:45:55
【问题描述】:
我创建了一个包含在 composer 中的名为 ShinePHP (https://packagist.org/packages/adammcgurk/shine-php#0.0.4) 的包,它在自动加载等方面一直运行良好...,但现在自动加载突然关闭了。这没有任何原因,我没有接触 composer.json 文件,我真的没有接触库 任何东西,我只是得到了错误:
致命错误:未捕获的错误:在中找不到类“ShinePHP\EasyHttp” /Applications/XAMPP/xamppfiles/htdocs/manager-reporting/src/index.php:12 堆栈跟踪:#0 {main} 抛出 /Applications/XAMPP/xamppfiles/htdocs/manager-reporting/src/index.php 在第 12 行
以下是调用该代码的方式:
<?php
declare(strict_types=1);
session_start();
require_once 'vendor/autoload.php';
require_once 'model/Page.php';
require_once 'model/Auth.php';
use ShinePHP\{Crud, CrudException, HandleData, HandleDataException, EasyHttp, EasyHttpException};
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
try {
EasyHttp::checkHttps();
} catch (EasyHttpException $ehe) {
// Google Analytics
echo $ehe->getMessage();
exit;
}
我知道这是这个特定库的问题,因为我在这里还安装了 Composer 的 PHPMailer,我只是尝试使用以下方法实例化 PHPMailer:
$mail = new PHPMailer(true);
而且没问题。
我跑过:
composer dumpautoload
得到了这样的回应:
Generating autoload files
为什么我的 ShinePHP 包的自动加载中断?
【问题讨论】:
标签: php composer-php