Including PHP functions from another file

前端 未结 5 2066
失恋的感觉
失恋的感觉 2021-01-20 02:01

I would like to access some functions defined in another PHP file, but that file also outputs content that I don\'t want to display.

Is there any way to access the f

5条回答
  •  自闭症患者
    2021-01-20 02:32

    Well, you could capture the output of the file using, say, an Output Buffer then discarding it. However, any other global side effects (global variables set, files written, etc) would still occur. It would be much better to refactor that file to move the functions into their own include, which can be includeed by both.

提交回复
热议问题