当我尝试在服务器上运行我的php代码但在查看代码时没有突出显示时,我得到了一个非常奇怪的错误。它是我第一次使用Composers和命名空间等构建的新项目的一部分。错误是:
[18-Apr-2017 20:06:32 UTC] PHP Fatal error: Uncaught Error: Class 'ThomasSmythLoginSystem' not found in /home/thomassm/public_html/php/functions/fncregister.php:4
文件布局:
LoginSystem.php
namespace ThomasSmyth;
class LoginSystem {
private $core;
private $builder;
private $config;
function __construct(){
$this->core = new coreFunctions();
$this->builder = new NilPortuguesSqlQueryBuilderBuilderGenericBuilder();
$this->cOnfig= require('core.config.php');
}
//...
}
fncRegister.php
require_once "../../vendor/autoload.php";
$LoginManager = new ThomasSmythLoginSystem();
echo $LoginManager->Register($_POST["StrSurname"], $_POST["StrForename"], $_POST["StrEmail"], $_POST["StrPassword"], $_POST["DteDoB"], $_POST["StrGender"], $_POST["StrToken"]);
composer.json
{
"require": {
"nilportugues/sql-query-builder": "^1.5"
},
"autoload": {
"psr-4": {
"ThomasSmyth": "php/lib/"
}
}
}
有没有人对可能导致此问题的原因提出任何建议,无论是代码还是服务器设置?