Best Way To Autoload Classes In PHP

前端 未结 6 672
陌清茗
陌清茗 2020-12-05 10:20

I\'m working on a project whereby I have the following file structure:

index.php
|---lib
|--|lib|type|class_name.php
|--|lib|size|example_class.php
         


        
6条回答
  •  余生分开走
    2020-12-05 11:07

    If you have an access to the command line, you can try it with composer in the classMap section with something like this:

    {
        "autoload": {
            "classmap": ["yourpath/", "anotherpath/"]
        }
    }
    

    then you have a wordpress plugin to enable composer in the wordpress cli : http://wordpress.org/plugins/composer/

提交回复
热议问题