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
Post a Comment