将单反和双反引号替换为php中的打字机引号
I'm trying to single reverse ‛
and double ‟
reversed quote in PHP using str_replace
method but its not getting replaced. I tried to convert it using htmlentities()
and replace it using their html values but its not also working.
Here's the code:
$text = htmlspecialchars($text, ENT_QUOTES, "UTF-8");
$text = str_replace("‛", "'", $text);
2nd attempt:
$text = str_replace("‛", "'", $text);
Reference for single and double reversed quote: http://en.wikipedia.org/wiki/Quotation_mark_glyphs
我正在尝试单一反向 这是代码: p>
第二次尝试: p>
单引号和双引号的引用: http ://en.wikipedia.org/wiki/Quotation_mark_glyphs p>
div>' code>并加倍
“ code >使用
str_replace code>方法在PHP中反转引用,但它没有被替换。 我尝试使用
htmlentities() code>转换它,并使用它们的html值替换它,但它也不能正常工作。 p>
$ text = htmlspecialchars($ text,ENT_QUOTES,“UTF-8”);
$ text = str_replace(“‛”,“'”,$ text);
code> pre>
$ text = str_replace(“'”,“'”,$ text); \ n code> pre>
@Eugene This should be the one. You forgot _decode
.
$text = str_replace(htmlspecialchars_decode("‛"), "'", $text);
This should work:
$text = str_replace(htmlspecialchars("‛"), "'", $text);