两种不同类型的编码之间的PHP字符串比较 [英] PHP string comparison between two different types of encoding
本文介绍了两种不同类型的编码之间的PHP字符串比较的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试将我知道的字符串与php中的网页标题匹配。
I am attempting to match a string I know to a web page title in php.
我有以下字符串:
ℛobinhood
我的页面标题看起来像这样:
I have a page title that looks like this:
ℛobinhood
但是实际上如果这样编码我看一下< title>
元素:
but is actually encoded like this if I look at the <title>
element:
ℛobinhood
我不确定如何比较这两个字符串。如何将&#8475;
转换为ℛ或以其他方式进行正确的比较?
I'm not sure how to compare these two strings. How do I either convert the ℛ
to ℛ or the other way so that I can do a proper comparison?
推荐答案
您可以使用htmlentites( http: //php.net/manual/en/function.htmlentities.php )转换为实体版本。
You can use htmlentites ( http://php.net/manual/en/function.htmlentities.php ) to convert to the entity version.
这篇关于两种不同类型的编码之间的PHP字符串比较的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文