Home >Backend Development >PHP Tutorial >What characters in php will affect the parsing of unserialize()?
What characters in PHP will affect the parsing of unserialize?
What characters in PHP will affect the parsing of unserialize?
Correct answer upstairs
For example, under utf8 encoding
echo serialize('我'); //输出: s:3:"我";
under gbk encoding
echo serialize('我'); //输出:s:2:"我";
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)!