Difference PHP function include, include_once, require and require_once of

 

Understand the next include, include_once, require and require_once four functions:

  • Functions include: the specified file will be read and executed inside the program;
  • require function: the contents of the target file will be read, and put themselves into these read-generation content;
  • include_once function: it includes and evaluates the specified file during script execution. This behavior and include statements similar, the only difference being that if the file has already been included too, will not be included again. As the name implies, it contains only once;
  • require_once function: statements and require exactly the same, the only difference is that PHP checks whether the file has been included too, if it will not be included again.

1 include and require the difference

include and require in addition to the different ways of processing import documents, the biggest difference is: include a warning is generated and the script will continue to execute when introducing file does not exist, but require will result in a fatal error and the script execution stops.

 

https://www.cnblogs.com/phpfensi/p/7861127.html

https://bbs.csdn.net/topics/390660368

 

Guess you like

Origin www.cnblogs.com/sea-stream/p/11184562.html