str_replace 不会用没有重音的字母替换重音字母。那有什么问题?
这将返回预期结果:
<?php
$string = get_post_custom_values ("text");
// Say get_post_custom_values ("text") equals "José José"
$string = str_replace(" ", "-", $string);
echo $string [0];
// Output "José-José"
?>
这不起作用:
<?php
$string = get_post_custom_values ("text");
// Say get_post_custom_values ("text") equals "Joseph Joseph"
$string = str_replace("é", "e", $string);
echo $string [0];
// Output "José José". Nothing has changed
?>
注意:使用谷歌翻译从葡萄牙语翻译而来。