If you include a php file, it will often fail. what do you need to pay attention? The online saying is related to the starting Terminator of php & lt ;? & Nbsp ;? & Gt ;. Let's talk about several situations. in the included php, 1. & lt ;? & Nbsp ;? & Gt; html2. & lt ;? & Nbsp ;? & Gt; only script3. & lt ;? & Include a php file, which often fails. what should I pay attention?
The online saying is related to the starting Terminator of php .
Let's talk about several situations,
Included php,
1. Before html
2. Only script
3. Html
In the main file,
1. php is used before and after include.
2. Before include, php is used.
3. include is followed by php
4. html before and after include
5. Before include, html
6. include is followed by html
Share :. Let's talk about several situations. in the included php, 1. Html2. Only script3. There are htm... 'data-pics = ''>
------ Solution --------------------
This post was last edited by xuzuning at 09:21:23
Include a php file, which often fails.
The reason is that the path is incorrect and it has nothing to do with the writing of the master file and the sub-file (of course, the two files must be correct)
For example
B. php
echo 'abcd';
A. php
echo 123;
include 'b.php';
?>
When a. php is executed, only the following code is executed:
Echo 123;
?>
Echo 'ABCD ';
?>
------ Solution --------------------
If an error occurs, an error message is displayed!
No code or error information is available, and errors cannot be found.
There is no problem with my example. The purpose is to let you understand what the include is.
------ Solution --------------------
Reference:
Please refer to my questions and give me comments based on several situations.
None of your situations...
------ Solution --------------------
The failure to include a file is irrelevant to the source code of the file where the include is located, and is related to the file to be included.
Reference
When a file is contained, the parser disconnects the target file from the PHP mode to the HTML mode and restores it to the end of the file. For this reason, any code in the target file that needs to be executed as PHP code must be included in the valid PHP start and end tags.
Self-built http://cn2.php.net/manual/zh/function.include.php
The other is the include path. if the path is incorrect, it will fail.