简体   繁体   中英

Blank spaces in php returning empty to ajax

I am comparing a string to check if a user already exist's , im doing it with ajax and i was sending an echo to compare it. and my comparison was always false and i was going crazy until i saw that BUG (don't know what to call that). Can someone explain me why this happens in php scripts? 在此处输入图片说明

在此处输入图片说明

It's common practice in pure php scripts to omit closing tag, thats to avoid an infinite list of problems with invisible characters in the response.

Its even recommended in the php manual

You can find more infos, some also related to ajax call/response, in this stackoverflow question .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM