Include () or require () functions. you can insert the content of a file into the file before the server executes the php file. apart from the different ways in which they handle errors, these two functions are the same in other aspects. the include () function generates a warning.
Include () or require () functions, you can insert the content of a file into the file before the server executes the PHP file, in addition to the way they handle errors, these two functions are the same in other aspects.
Include () or require () functions, you can insert the content of a file into the file before the server executes the php file, in addition to the way they handle errors, these two functions are the same in other aspects. the include () function generates a warning (but the script continues to execute), and The require () function generates a fatal error (fatal error) (The execution will be stopped when an error occurs ).
-
-
-
- Welcome to my home page
Some text
-
-
Three Files: "default. php", "about. php", and "contact. php" all reference the "menu. php" file. this is the code in "default. php:
-
- Welcome to my home page
Some text
-
-
Require () function
The require () function is the same as include (), but the difference is that it handles errors.
The include () function generates a warning (but the script continues to execute), and The require () function generates a fatal error (the execution will be stopped when an error occurs ).
If an error occurs when you reference a file through include (), an error message similar to the following is returned:
-
-
-
- Include ("wrongfile. php ");
- Echo "hello world! ";
- ?>
-
-
Error message:
Warning: include (wrongfile. php) [function. include]: failed to open stream: no such file or directory in c: homewebsitetest. php on line 5 warning: include () [function. include]: failed opening 'wrongfile. php 'for declaration (include_path = '.; c: php5pear ') in c: homewebsitetest. php on line 5 hello world!