str_replace()不会用重音替换字符

ion*_*ion 3 html php string str-replace

我有一个非常长的html字符串,其中包含希腊语和英语文本,其中大多数单词都包含html标签.我已经成功地使用下面的函数来删除文本中的希腊语重音符,以便它可以很好地大写.

但是在一些字符之后的本文中,替换停止发生,文本返回重音符号.我已经尝试了一些其他功能,我在网络上找到但没有运气.

有帮助吗?

我正在使用的功能是:

public static function stripAccents($str) {
    $a = array('?','?','?','?','?','?','?','?','?','?','?','?','?','?','?');
    $b = array('?','?','?','?','?','?','?','?','?','?','?','?','?','?','?');
    return str_replace($a, $b, $str);
}
Run Code Online (Sandbox Code Playgroud)

并且文本的示例是:

<div class="menu-page">

<h3>DESSERTS / ?????????</h3>

<h4>GOAT CHEESE ICE CREAM (N)</h4>
<p class="price">€7,50</p>
<p>??????? ???? ??????????? ????? ?? ?????????? ????????? & ?????? ?????????</p>
<p>With tomato marmalade & lemon cream</p>

<div class="clearfix"></div>

<h4>MOCHA A LA PALAIA</h4>
<p class="price">€8,50</p>
<p>??????? ?????, ????????? & ???????? ????????</p>
<p>Coffee and vanilla ice cream & Italian meringue<p>

<div class="clearfix"></div>

<h4>THE TRAIL OF CHOCOLATE (N)</h4>
<p class="price">€9,50</p>
<p>????????? ????????? & ????? ???? ??????????</p>
<p>Chocolate and different orange textures</p>

<div class="clearfix"></div>

<h4>CANNOLO</h4>
<p class="price">€9,50</p>
<p>??????? ????????? ???????? ?? ????????? ??? passion fruit sorbet</p>
<p>Chocolate cannolo with passion fruit sorbet</p>

<div class="clearfix"></div>

<h4>AUBERGINE TIRAMISU</h4>
<p class="price">€12,00</p>
<p>?? ???? ??????????</p>
<p>With eggplant mousse</p>

</div>
Run Code Online (Sandbox Code Playgroud)

Riz*_*123 6

它不起作用,因为它们是不同的字符.如果你在寻找例子?.

在你的功能中它是:

CE BF CC 81 //??
Run Code Online (Sandbox Code Playgroud)

但在你的字符串中你有:

CF 8C //?
Run Code Online (Sandbox Code Playgroud)

因此,请确保在字符串和函数中使用相同的字符