摘自When should I use require_once vs include?

1.When should I use require vs. include? here

The require() function is identical to include(), except that it handles errors differently. If an error occurs, the include() function generates a warning, but the script will continue execution. The require() generates a fatal error, and the script will stop.

2.When should I use require_once vs. require? here

The require_once() statement is identical to require() except PHP will check if the file has already been included, and if so, not include (require) it again.

本文地址 php下的include和require 转载请注明出处