Home  >  Article  >  Backend Development  >  Solutions to garbled characters and Sessions verification issues in sessions PHP!

Solutions to garbled characters and Sessions verification issues in sessions PHP!

WBOY
WBOYOriginal
2016-07-29 08:39:161008browse

When reading Chinese or other language characters in a PHP script is garbled, 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 such a mistake at the beginning. If you are editing in Dreamweaver, please follow: Edit---"Preferred Parameters---"New Document and set the language to UTF8 encoding.

About SESSION verification issue: At the beginning, all my documents were written in GB2312 Later, a website needed to use 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 to the file header of the script program. (BOM) So I converted it directly and the result was wrong: Cannot send session cookie - headers already sent by...

Debugging depressingly for a long time before I found three solutions:

First The first is, as mentioned just now, to convert the source file using Dreamweaver or UltraEdit... and other tools that support UTF8 conversion. This is the most fundamental solution;

The second is to use session_start( ) Add an "@" in front of the function

The third method is to open phpinfo() and see if the Output_buffering parameter is no value. If so, set it to 1

The above introduces the solutions to garbled characters in sessions PHP and session verification problems! , including sessions content, I hope it will be helpful to friends who are interested in PHP tutorials.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn