str_replaceon®符号在PHP中不起作用

ric*_*iot 0 php string str-replace

在标题中说的都是真的.以下代码始终返回false:

$product = str_replace('®', '', $product);    
Run Code Online (Sandbox Code Playgroud)

我也尝试过搜索®符号的html实体.

这有解决方案吗?

ʰᵈˑ*_*ʰᵈˑ 5

由于文件编码,您必须将符号解码为它的实体值(®)

$product = html_entity_decode(str_replace('®', '', htmlentities($product)));
Run Code Online (Sandbox Code Playgroud)