PHP解密Unicode及Escape加密字符串函数
php代码
<?php function uni_decode($s) { preg_match_all('/\&\#([0-9]{2,5})\;/', $s, $html_uni); preg_match_all('/[\\\%]u([0-9a-f]{4})/ie', $s, $js_uni); $source = array_merge($html_uni[0], $js_uni[0]); $js = array(); for($i=0;$i<count($js_uni[1]);$i++) { $js[] = hexdec($js_uni[1][$i]); } $utf8 = array_merge($html_uni[1], $js); $code = $s; for($j=0;$j<count($utf8);$j++) { $code = str_replace($source[$j], unicode2utf8($utf8[$j]), $code); } return $code;//$s;//preg_replace('/\\\u([0-9a-f]{4})/ie', "chr(hexdec('\\1'))", $s); } function unicode2utf8($c) { $str=""; if ($c < 0x80) { $str.=chr($c); } else if ($c < 0x800) { $str.=chr(0xc0 | $c>>6); $str.=chr(0x80 | $c & 0x3f); } else if ($c < 0x10000) { $str.=chr(0xe0 | $c>>12); $str.=chr(0x80 | $c>>6 & 0x3f); $str.=chr(0x80 | $c & 0x3f); } else if ($c < 0x200000) { $str.=chr(0xf0 | $c>>18); $str.=chr(0x80 | $c>>12 & 0x3f); $str.=chr(0x80 | $c>>6 & 0x3f); $str.=chr(0x80 | $c & 0x3f); } return $str; } $str='%u5927%u5BB6%u597D%uFF0C \u8FD9\u662F\u6D4B\u8BD5\u6587\u672C\uFF01'; echo uni_decode($str);
登录后复制
本站声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn

热AI工具

Undresser.AI Undress
人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover
用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool
免费脱衣服图片

Clothoff.io
AI脱衣机

Video Face Swap
使用我们完全免费的人工智能换脸工具轻松在任何视频中换脸!

热门文章
刺客信条阴影:贝壳谜语解决方案
3 周前
By DDD
Windows 11 KB5054979中的新功能以及如何解决更新问题
2 周前
By DDD
刺客信条阴影 - 如何找到铁匠,解锁武器和装甲定制
1 个月前
By DDD
在哪里可以找到原子中的起重机控制钥匙卡
3 周前
By DDD
<🎜>:死铁路 - 如何完成所有挑战
3 周前
By DDD

热工具

记事本++7.3.1
好用且免费的代码编辑器

SublimeText3汉化版
中文版,非常好用

禅工作室 13.0.1
功能强大的PHP集成开发环境

Dreamweaver CS6
视觉化网页开发工具

SublimeText3 Mac版
神级代码编辑软件(SublimeText3)
