【发布时间】:2017-09-25 14:33:12
【问题描述】:
这里是composer.json
{
"name": "uci/uci-wp-webauth",
"description": "Wordpress plugin for enabling WebAuth logging in for UCI users on a site-by-site basis.",
"type": "project",
"license": "GPL-3.0",
"minimimum-stability": "stable",
"autoload": {
"psr-4": {
"": "includes/"
}
},
"require": {
"uci/uci-lib": "dev-master#9097b4f"
},
"repositories": [
{
"type": "vcs",
"url": "git@github.com:username/uci-lib"
}
]
}
目录结构如下:
UCI
-WebAuth.php
WebAuth 类的结构如下:
namespace UCI;
class WebAuth {}
实现 WebAuth 的类/代码:
namespace WebAuth;
use UCI\WebAuth;
class Handler
{
public function __construct()
{
$this->init();
$this->webauth = new WebAuth();
由于某种原因 PHP 不断报告:
Fatal error: Uncaught Error: Class 'UCI\WebAuth' not found
在建立一个作曲家项目之前,我已经做过很多次了,但是这个真的让我很难过。
【问题讨论】:
标签: php namespaces composer-php autoload