Home › Forums › Back End › include vs file_get_contents › Reply To: include vs file_get_contents
April 30, 2016 at 9:58 am
#241111
Beverleyh
Participant
include() allows the execution of functions/code from with the included file.
file_get_content() interprets the incoming content as a string. Any code inside won’t be executed.
Usage depends on what you’re trying to achieve. For static data (like records from a txt/csv file), or user generated content or files that are writable, file_get_content() is the safer way to incorporate them. But if you want to pull in variables or code that can execute (like a config or plugin file), an include() is the way to go.