반응형
htmlentity()를 되돌리는 방법?
아이같은 특별한 캐릭터는 제가 전화할 수 있습니다.htmlentities()
:
$mycaption = htmlentities($mycaption, ENT_QUOTES);
해당 html 엔티티를 가져오려면:
áéí
이걸 어떻게 다시 á이로 돌릴 수 있죠?
사용하는 경우htmlentities()
인코딩하려면 다음을 사용할 수 있습니다.html_entity_decode()
프로세스를 반전시키는 방법:
html_entity_
모든 HTML 엔티티를 해당 문자로 변환합니다.
html_entity_decode()는 문자열의 모든 HTML 엔티티를 해당 문자로 변환한다는 점에서 htmlenties()와 반대입니다.
예.
$myCaption = 'áéí';
//encode
$myCaptionEncoded = htmlentities($myCaption, ENT_QUOTES);
//reverse (decode)
$myCaptionDecoded = html_entity_decode($myCaptionEncoded);
html_entity_decode를 보고 어떤 문자 집합을 사용해야 하는지 고민하려고 합니다(아마도 ISO8859-1).
캐릭터 세트 등에 관한 이 기사를 읽어볼 가치도 있을 것입니다.
찾으시는 것 같네요.
html_entity_decode()
html_entity_decode()
이는 다음에 대한 문서의 맨 처음에서 찾을 수 있습니다.
string html_entity_decode ( string $string [, int $quote_style = ENT_COMPAT [, string $charset = 'UTF-8' ]] )
언급URL : https://stackoverflow.com/questions/6465263/how-to-reverse-htmlentities
반응형
'programing' 카테고리의 다른 글
그래들 빌드 실패: 주 클래스 이름이 구성되지 않아 확인할 수 없습니다. (0) | 2023.10.19 |
---|---|
Facebook 인앱 브라우저에서 웹사이트가 열리지 않는 경우 (0) | 2023.10.19 |
C에서 빠르고 효율적인 최소 제곱 적합 알고리즘? (0) | 2023.10.14 |
인스턴스가 하나만 있는 경우 인스턴스 또는 클래스 특성을 사용해야 합니까? (0) | 2023.10.14 |
vue javascript 내 정적 자산 참조 방법 (0) | 2023.10.14 |