How to display special characters in PHP

前端 未结 9 1340
野的像风
野的像风 2020-11-30 12:24

I\'ve seen this asked several times, but not with a good resolution. I have the following string:

$string = \"

Résumé

\";

9条回答
  •  难免孤独
    2020-11-30 13:11

    Try This

    Input:

    
    
    
    
    bold text.";
    echo htmlspecialchars($str);
    ?>
    
    

    Converting < and > into entities are often used to prevent browsers from using it as an HTML element.
    This can be especially useful to prevent code from running when users have access to display input on your homepage.

    Output:

    This is some bold text.
    
    Converting < and > into entities are often used to prevent browsers from using it as an HTML element. This can be especially useful to prevent code from running when users have access to display input on your homepage.
    

提交回复
热议问题