escaping - Removing new lines and escape characters introduced when reading file in PHP -


{   "elements": [     {       "cardtype": "textcard",       "title": "final fantasy",       "titlesize": "medium"     }   ] } 

the above content of file. want return in response. use file_get_contents read contents, however, this:

{\n  \"elements\": [\n    {\n      \"cardtype\": \"textcard\",\n      \"title\": \"final fantasy\",\n      \"titlesize\": \"medium\",\n ... 

the new lines , escaping not want. there way avoid that?

use following code removing \n data. $filedata = str_replace(array("\r", "\n"), '', file_get_contents($filename));


Comments

Popular posts from this blog

Fail to load namespace Spring Security http://www.springframework.org/security/tags -

sql - MySQL query optimization using coalesce -

unity3d - Unity local avoidance in user created world -