How to display special characters in PHP

前端 未结 9 1338
野的像风
野的像风 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:02

    This works for me:

    Create/edit .htaccess file with these lines:

    AddDefaultCharset UTF-8
    AddCharset UTF-8 .php
    

    If you prefer create/edit php.ini:

    default_charset = "utf-8"
    

    Sources:

    • https://stackoverflow.com/a/6989559/496176
    • https://stackoverflow.com/a/1610475/496176

提交回复
热议问题