PHP/HTML display hidden characters

后端 未结 5 1711
梦如初夏
梦如初夏 2021-01-02 20:41

So, I have a bunch of code that I\'m pulling from a column in MySQL. This code includes hidden characters, such as \"\\t\" and \"\\n\".

I\'m trying to get that raw c

5条回答
  •  悲哀的现实
    2021-01-02 21:12

    Please note that in PHP "string" and 'string' are actually the same thing.

    htmlentities() just converts quote characters and other special characters to their HTML entity equivalent. See this page

    Escape your slashes and (optionally) enclose the code that you want explicity shown in 'pre' tags. The pre tags are not necessary but can help readability.

    Here is the code I tested:

    ".$value."
    "; echo $value; ?>

提交回复
热议问题