PHP/HTML display hidden characters

后端 未结 5 1712
梦如初夏
梦如初夏 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:19

    Hmm, that should be working... Maybe the newline characters are actually carriage returns? In which case, something like this would be flexible:

    // Simple example: replace all newlines with their character equivalent
    $value = preg_replace('/[\r\n]+/', '\n', $value);
    echo htmlentities($value);
    

提交回复
热议问题