What characters in php will affect the parsing of unserialize()?

PHP中文网
Release: 2016-08-18 09:16:10
Original
1178 people have browsed it


What characters in PHP will affect the parsing of unserialize?

Reply content:

What characters in PHP will affect the parsing of unserialize?


Correct answer upstairs
For example, under utf8 encoding

echo serialize('我'); 
//输出: s:3:"我";
Copy after login

under gbk encoding

echo serialize('我'); 
//输出:s:2:"我";
Copy after login

So you can never serialize the 3-byte long 'I' under utf8 encoding and deserialize under gbk encoding parsed out


I think it should be caused by the inconsistency between the encoding when serializing the data and the encoding when deserializing, or you can post the wrong statement for easy analysis


/

In the past two days, I I have encountered

The above is what characters in PHP will affect the parsing of unserialize()? For more related content, please pay attention to the PHP Chinese website (www.php.cn)!


Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!