Including PHP functions from another file

前端 未结 5 2068
失恋的感觉
失恋的感觉 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:31

    You could sneakily buffer the include's output using ob_start() and drop it using ob_end_clean(). This works only if the script doesn't flush the output buffer itself.

    The better way would be to extract the needed functions from the include, and put them into a separate file.

提交回复
热议问题