【发布时间】:2019-10-21 10:37:20
【问题描述】:
我正在为 TYPO3 v9.5.9 开发一个扩展,并且已经编写了我所有的代码,但是当我尝试使用该扩展时,我收到一条错误消息说
类 Secsign\Secsign\Controller\SecsignController 不存在。 反射失败。
<?php
namespace Secsign\Secsign\Controller;
$apiPath = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('secsign') . 'Resources/Public/SecSignIDApi/phpApi/SecSignIDApi.php';
require_once($apiPath);
use AuthSession;
use SecSignIDApi;
use \TYPO3\CMS\Core\Utility\GeneralUtility;
/**
* SecsignController
*/
class SecsignController extends ActionController
{...}
控制器确实存在,但由于某种原因无法找到。这个错误发生在哪里?我如何解决它?欢迎任何提示。
composer.json 文件如下所示:
{
"name": "secsign/secsign",
"type": "typo3-cms-extension",
"description": "This extension allows users to authenticate using their smart phone running the SecSign App.",
"authors": [
{
"name": "SecSign Technologies Inc.",
"role": "Developer"
}
],
"require": {
"typo3/cms-core": "^9.5"
},
"autoload": {
"psr-4": {
"Secsign\\Secsign\\": "Classes",
"TYPO3\\CMS\\Secsign\\": "public/typo3conf/ext/secsign/Classes/"
}
},
"autoload-dev": {
"psr-4": {
"Secsign\\Secsign\\Tests\\": "Tests"
}
},
"replace": {
"secsign/secsign": "self.version",
"typo3-ter/secsign": "self.version"
}
}
【问题讨论】:
-
您是否尝试过刷新系统缓存并重建 PHP 自动加载信息?
-
是的,我已经尝试过多次了。没有运气。
-
尝试从命名空间中删除反斜杠。查看@jokumer 的回答here
-
1) 不建议使用带有前导反斜杠的
use语句(但无论如何应该可以使用)2) 您的 composer.json 看起来如何? -
@GhanshyamBhava 我必须在我的每一节课上都这样做吗?
标签: php typo3 typo3-9.x typo3-extensions