Merging multiple PHP script into a single file

前端 未结 6 2004
礼貌的吻别
礼貌的吻别 2021-02-05 07:59

I have a PHP script which includes one or two other libraries it depends on using the \'include\' statement. To make it more easily portable, I would like to someho

6条回答
  •  误落风尘
    2021-02-05 08:30

    There's no built in way to do that. I would recommend packaging your code up into a directory and distributing it that way. I do this with PHP, I place the code into a directory "something.module", and then have iterate through a modules directory, including the main file underneath each .module directory. But for something more simple, you could just have a structure like:

    my_package/
      my_package.php
      include1.php
      include2.php
    

    my_package.php would include(realpath(dirname(__FILE__).'/inclue1.php')). All other scrits would just have to include('my_packahe/my_package.php')

提交回复
热议问题