When Chinese or other language characters are read as garbled characters in a PHP script, first check whether your file format is saved in UTF8 encoding format. If not, please use UltraEdit... and other tools that support UTF8 conversion to convert it. It is best not to use MS Notepad to directly save as conversion. I made this mistake at the beginning mistake. If you are editing in Dreamweaver, please follow: Edit---》Preferred Parameters---》Create a new document and set the language to UTF8 encoding.
Regarding the SESSION verification issue: At first, all my documents were written in GB2312. Later, a website required UTF-8 encoding, so I opened some of my files with MS Notepad and saved them as UTF. -8 encoding, I didn’t expect that he would add a signature (BOM) to the file header of the script program, so I converted it directly and the result was an error: Cannot send session cookie - headers already sent by ...
After debugging for a long time, I found three solutions:
The first is as mentioned just now, convert the source file using Dreamweaver or UltraEdit... and other tools that support UTF8 conversion. This is the most fundamental solution;
The second method is to add an “@” in front of the session_start() function
The third method is to open phpinfo() and see if the Output_buffering parameter is no value. If so, set it to 1