-2
html_entity_decode()는 HTML 엔터티를 반환하며 문자는 사용할 수 없습니다. html_entity_decode()가 작동하지 않습니다. (PHP)
<meta http-equiv="Content-Type" content="text/html charset=UTF-8">
<?php
$code='a'; // It's a code of 'a' UTF-8 character.
$char = html_entity_decode($code, ENT_COMPAT, $encoding = 'UTF-8');
/*
Now $char must contains 'a' value, but it contains 'a';
You can check this by following tests
*/
var_dump('a' === 'a'); // bool(false), of course.
var_dump('a' === $code); // bool(true)
var_dump('a' === $char); // bool(true) BUT MUST BE FALSE
var_dump($code === $char); // bool(true) BUT MUST BE FALSE
// Or this:
echo str_replace('&', '', $char); // it must print 'a', but it print '#97'
글자 참조에 ';':':'a '이 없습니다. – Gumbo
PHP는 파이썬이 아니며 명명 된 매개 변수가 없습니다. '$ encoding = 'UTF-8'은 아마도 당신이 생각하는대로하지 않을 것입니다. 함수 호출은 단순히'html_entity_decode ($ code, ENT_COMPAT, 'UTF-8')'이어야합니다. – deceze