How do you add abstract class library in the Codeigniter framework?

前端 未结 5 625
天命终不由人
天命终不由人 2020-12-31 20:27

I have the following code in file called AbstractClass.php in the libraries folder

abstract class AbstractClass {
  abstract prote         


        
5条回答
  •  暖寄归人
    2020-12-31 20:42

    Well obviously you cannot load an abstract class directly as this goes against the point of an abstract class.

    You can put an abstract class in a file along with another library, but that is a bit pointless and goes against the "one class one file" standard that CI (and all good standards) suggest.

    You can include this file with an include() in your library files, or set up an __autoload() function to do it for you. Best place for an __autoload() is the bottom of config.php.

提交回复
热议问题