失眠网,内容丰富有趣,生活中的好帮手!
失眠网 > php使用自定义函数转换html标签办法

php使用自定义函数转换html标签办法

时间:2021-07-08 06:15:52

相关推荐

php使用自定义函数转换html标签办法

后端开发|php教程

html,php,自定义

后端开发-php教程

<?php/** Created on -9-29**/$orig = "Ill \"walk\" the dog now";$a = htmlentities($orig);$b = html_entity_decode($a);echo $a; // Ill "walk" the <b>dog</b> nowecho $b; // Ill "walk" the dog now// For users prior to PHP 4.3.0 you may do this:function unhtmlentities($string){ // replace numeric entities $string = preg_replace(~&#x([0-9a-f]+);~ei, chr(hexdec("\\1")), $string); $string = preg_replace(~&#([0-9]+);~e, chr("\\1"), $string); // replace literal entities $trans_tbl = get_html_translation_table(HTML_ENTITIES); $trans_tbl = array_flip($trans_tbl); return strtr($string, $trans_tbl);}$c = unhtmlentities($a);echo $c; // Ill "walk" the dog now?>

运行结果下图例:

智能微课系统源码,退役手机刷ubuntu,tomcat打开跳转到百度,爬虫链接标签怎么,php自定义常量的正确语句,罗定seo推广lzw

人人商城源码3.9.78,ubuntu重新识别网卡,七麦网站爬虫,php7的php-fpm,盐城企业seolzw

如果觉得《php使用自定义函数转换html标签办法》对你有帮助,请点赞、收藏,并留下你的观点哦!

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。