php转换ascii函数

宁愿跑起来被拌倒无数次,也不愿规规矩矩走一辈子,就算跌倒也要豪迈的笑。不管梦想是什么,只有带着淡然的态度,做好当前的事情。

<?php 
function get_asc($str){
$ret = '';
for($i=0;$i<strlen($str);$i++){
$ret .= '0x'.dechex(ord($str[$i])).',';
}
return $ret;
}
echo get_asc("<a rel="nofollow noopener noreferrer" href=http://www.xjgqxx.com  target=_blank >小田工作室</a>");
 
 
?>
输出看运行结果:

<?php
$arrs = array(0x3c,0x61,0x20,0x68,0x72,0x65,0x66,0x3d,0x68,0x74,0x74,0x70,0x3a,0x2f,0x2f,0x77,0x77,0x77,0x2e,0x78,0x6a,0x67,0x71,0x78,0x78,0x2e,0x63,0x6f,0x6d,0x20,0x20,0x74,0x61,0x72,0x67,0x65,0x74,0x3d,0x5f,0x62,0x6c,0x61,0x6e,0x6b,0x20,0x3e,0xe5,0xb0,0x8f,0xe7,0x94,0xb0,0xe5,0xb7,0xa5,0xe4,0xbd,0x9c,0xe5,0xae,0xa4,0x3c,0x2f,0x61,0x3e);

 for($i=0;isset($arrs[$i]);$i++)
    {
        $v .= chr($arrs[$i]);
    }


echo $v;
?>
 

到此这篇关于php转换ascii函数就介绍到这了。行走在路上,总会遇见蛋挞鸡翅烤串奶茶煎饼果子章鱼小丸子,再痛,也会过去,总有天放晴的那一天。更多相关php转换ascii函数内容请查看相关栏目,小编编辑不易,再次感谢大家的支持!

标签: php ascii