String processing problem preg_replace (). if there is a strange replacement, please solve it! Http: //. com/item.htm? Id = 14135039282 & amp; ref = http % 3A % 2F % 2Fsearch8.taobao.com % 2 Fsearch % 3Fq % 3D % 25C4% string processing problem preg_replace (), Strange replacement, please solve it!
Http: //. com/item.htm? Id = 14135039282 & ref = http % 3A % 2F % 2Fsearch8.taobao.com % 2 Fsearch % 3Fq % 3D % 25C4% 25DA % 25BF % 25E3% 2B % 25C4% 25D0% 26cat % 3D50026972% 26 commend % 3 Dall % 26 style % 3 Dgrid % 26 ppath % 3D2048150% 253A105206% 26cps % 3 Dyes % 26pid
The above is the original string. Why does it go through the following processing?
', Htmlentities ($ rw ['content'], ENT_QUOTES, GB2312)?>
After processing, it is displayed as this way. please note? Automatic line feed after the No.
Http: //. com/item.htm?
Id = 14135039282 & ref = http % 3A % 2F % 2Fsearch8.taobao.com % 2 Fsearch % 3Fq % 3D % 25C4% 2
Another question is that the strings stored in the database are as follows:
Me
Me
Me
Me
After ', Htmlentities ($ rw ['content'], ENT_QUOTES, GB2312)?> After this processing, it is displayed as follows:
Me
Me
Me
Me
Why do we replace a space here? If \ n is added to the layer-in mode, the above situation will not occur.
------ Solution --------------------
You don't have to solve it any more. this is not a problem at all. even if you directly echo it ,? A new line will also be added later. the browser treats the string between question marks as a word. if the word length exceeds one screen, the new line will be rolled back. The same effect will be achieved when the word is used to edit English, so it's just about the browser.
You can insert question marks in the following section and adjust the browser width.
PHP code