Differences between include () and fopen () functions and efficiency include () garbled fopen () functions
Q: differences and efficiency between include () and fopen () functions
If I want to reference a file, is it highly efficient to use include () or fopen ()? what is the difference, for example:
Test. php file
$ AB = "sfsadfsadfd ....";
....
?>
High-end files, AB. php
Include (test. php); or fopen (test. php) // Can you call the $ AB variable!
?>
Currently, the mainstream CMS uses INCLUDE or FOPEN to call files!
There is another problem, I use include () to introduce the file, the volume of the variable has Chinese he will be garbled, but I in the header to set the UTF-8, this problem occurs during PHP5.2 testing, but not in the latest PHP version.
Reply to discussion (solution)
Use include ();
You can save it as a social media code.
Does fopen have the same effect as include? I have to go to manual...
Include is an external program file that is integrated with the current program.
Fopen is used to open a file.
Each has its own role and cannot be confused.
I added htmlentities () for conversion and printed it as a code. the code is as follows:
$ Fieldvalue = implode ("','", $ fieldvalue). "', now (), now (),'". $ globalop. "'"; // value
// $ Fieldvalue = htmlentities ($ fieldvalue); garbled characters are generated when this parameter is added.
==================================
Is it enabled or introduced?
The two are different.
Good introduction, high efficiency
The include () and fopen () functions differently. include () introduces an external file, which can be an absolute or relative path. if a file is introduced by mistake, a prompt is displayed, and it contains the variable range that inherits the include row, but fopen () is to open a file, which can be an absolute or relative path, or a url request.
Include is a file, fopen is a file, not the same function
Include is an external program file that is integrated with the current program.
Fopen is to open a file ??
Can't I use the variables when I open them?
Variables cannot be directly used for fopen, and variables can be directly used for include.
Use a variable after opening. you can add an eval.
I don't know if the function definition is valid.
The two cannot be confused.
The two functions have different concepts.