Friday 4 January 2019

php - Why does json_encode escape the forward slash ( / )?











The function argument below is a string run through json_encode(). I see that the forward slash in http:// is escaped to http:\/\/.
Obviously it is a special character when used like this but only when used in that structure.



There is no immediate problem..but I need to understand escapes to make some code updates.





php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...