将扩展类拆分为不同的文件php

问题描述

| 森纳里奥 我有一个作为抽象类扩展的类。抽象类使用它们的方法加载我的文件和扩展名(抽象类的链接到pastebin)。 这在我的extends类中这样调用(缩短和简化-拼写错误仅在Q代码中出现):
class Pagination extends Pagination_Base
{
    function __construct()
    {
        // loads the file \"first.class.php\" in the abstract class
        parent::load_file( \'first\' ); 
        // stores the class as object in the abstract class,so we can access the methods and properties
        parent::load_extension( new oxoFirst() );
    }
}
问题/疑问 现在我得到了错误“无法重新声明类{$ classname} \”。 我想使用我的抽象类,但仍然能够将包含扩展名的类移动到单独的文件中。有什么办法吗? 提前致谢!     

解决方法

load_file
功能中使用
include_once
代替
include
。     

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...