简体   繁体   English

致命错误:找不到类__

[英]Fatal error: Class __ not found

Last spring I was working on a project using PHP, and it was working well. 去年春天,我正在使用PHP开发一个项目,并且运行良好。 I had no time to work on it later, but now after I changed hosting I want to work on it again. 以后我没有时间去处理它,但是现在在更改主机后,我想再次处理它。 I send files in working directory, but the error appears. 我在工作目录中发送文件,但出现错误。 It says that can't find Class TemplateLogin in class Login 它说在类Login中找不到类TemplateLogin

Login.php: login.php中:

class Login extends TemplateLogin

TemplateLogin.php: TemplateLogin.php:

abstract class TemplateLogin extends Core

Login.php and TemplateLogin.php are in the same folder Login.php和TemplateLogin.php在同一文件夹中

Your file Login.php needs to require or include the file TemplateLogin.php: 您的文件Login.php需要或包含文件TemplateLogin.php:

require_once 'TemplateLogin.php';

Or php will not know how the class TemplateLogin is defined. 否则php将不知道如何定义TemplateLogin类。

An alternative to manually including/requiring every file is to define an autoloading function . 手动包含/要求每个文件的一种替代方法是定义自动加载功能

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM