Include () garbled fopen () function
Ask you heroes: include () and fopen () function difference and efficiency
If I want to refer to a file, is the use of include () high efficiency or with fopen () high efficiency, his difference is what, for example:
test.php file
$ab = "SFSADFSADFD ...";
....
?>
High-use files, ab.php
Include (test.php); or fopen (test.php)//Can call $AB variable!
?>
Now the mainstream CMS his call file is to use include or fopen it!
There is another problem, I use the include () to introduce file parts, the amount of variables have Chinese he will be garbled, but I in the head to set up a UTF-8, in the PHP5.2 test will appear this situation, but in the latest version of PHP does not appear in this situation
Reply to discussion (solution)
use include ();
You save as, look at the social code.
Fopen like the include effect? I have to go to see manual.
Include is the introduction of an external program file that is in harmony with the current program
Fopen is to open a file
Each has a role, can not confuse
Garbled problem, I added the htmlentities () conversion, and then print out is into code, the code is as follows
$fieldvalue = Implode ("', '", $fieldvalue). "', now (), now (), '". $globalop. "'"; /value
$fieldvalue = Htmlentities ($fieldvalue); Add this will be garbled
=============================
Is that open, or is it good to be introduced?
The two are different.
Good introduction, high efficiency
The include () and fopen () functions are not the same, include () is to introduce an external file, can be an absolute or relative path, the introduction of a file error occurs when prompted, and it contains the row that inherits the include variable scope, but fopen () is to open a file, can be an absolute or relative path, or it can be a request in the form of a URL.
Include is an include file, fopen is an open file, not the same feature
Include is the introduction of an external program file that is in harmony with the current program
fopen is open a file??
Can't you use the variables in the open?
Fopen cannot use variables directly, include can use variables directly
To use a variable after open, you can add another eval.
If the function definition is valid, you do not know.
The two cannot be confused.
The concept of 2 functions is different