This article solves two problems at the same time: require and include Reference url in php and the file encoding conversion function in php. If you need it, you can refer to it.
If the "allow_url_fopen" option is enabled in PHP configuration, you can use url as the include or require parameter.
For more information about allow_url parameters, see the description in php. ini.
Convert the entire page
This method applies to all encoding environments. In this way, the character sets other than the first 128 characters (display characters) are expressed by NCR (Numeric character reference, for example, "Chinese characters" will be converted to "Chinese characters, such encoding can be normally displayed on the page in any encoding environment.
Another problem:
This method applies to all encoding environments. In this way, the character sets other than the first 128 characters (display characters) are expressed by NCR (Numeric character reference, for example, "Chinese characters" will be converted to "Chinese characters, such encoding can be normally displayed on the page in any encoding environment.
Add the following three lines of code to the header of the PHP file:
| The Code is as follows: |
Copy code |
Mb_internal_encoding ("gb2312"); // here, gb2312 is the original code of your website.
Mb_http_output ("HTML-ENTITIES ");
Ob_start ('mb _ output_handler ');
|
To use the mb_convert_encoding function, you must enable the mbstring (multi-byte string) Extension of PHP.
If the php mbstring extension is not enabled, you need to make the following settings: