php 内置的 html 格式化/美化tidy函数 -- 让你的HTML更美观
php 内置的 html 格式化/美化tidy函数
https://github.com/htacg/tidy-html5
# HTML 格式化 function beautify_html($html){ $tidy_config = array( 'clean' => false, 'indent' => true, 'indent-spaces' => 4, 'output-xhtml' => false, 'show-body-only' => false, 'wrap' => 0 ); if(function_exists('tidy_parse_string')){ $tidy = tidy_parse_string($html, $tidy_config, 'utf8'); $tidy -> cleanRepair(); return $tidy; } else return $html; } # Install libtidy (needed for tidy2.0 compile) apt-get -y install libtidy-0.99-0 # Install GNU tools for compiling apt-get -y install build-essential apt-get -y install libtidy-dev # Download tidy2.0 source (this can also be found in the PHP5 sourcecode, I just tarred it up to make this easier) wget -c http://support.office-shadow.com/installer/tidy2.0.tar.gz # Unpack the source tar xvzf tidy2.0.tar.gz # Configure tidy for installed php5 API cd tidy phpize # Configure & Compile the source ./configure make clean <-- Without this the compile builds a bad module for some reason make make install # Install module into php.ini echo "extension=tidy.so" >> /etc/php5/apache2/php.ini; see: http://ubuntuforums.org/showthread.php?t=195636&highlight=php5+tidy
php 内置的 html 格式化/美化tidy函数 -- 让你的HTML更美观的更多相关文章
- python内置函数,匿名函数
一.匿名函数 匿名函数:为了解决那些功能很简单的需求而设计的一句话函数 def calc(n): return n**n print(calc(10)) #换成匿名函数 calc = lambda n ...
- python成长之路八 -- 内置函数
1,python内置函数 内置函数 abs() dict() help() min() setattr() all() dir() hex() next() slice() a ...
- python - format函数 /class内置format方法
format函数 # format函数 # 用于字符串格式化 # 基本用法: # 方式一:(位置方式) x = "{0}{1}{2}".format(1,2,3) print('1 ...
- 2019-03-18-day013-装饰器与内置函数
上周回顾 函数: def 函数名(): 缩进 函数体 闭包: a = 50 def func(): a = 10 def avg(): print(a) 函数名的使用: 当做值被赋值给变量 当做返回值 ...
- Python3中的内置函数
内置函数 我们一起来看看python里的内置函数.什么是内置函数?就是Python给你提供的,拿来直接用的函数,比如print,input等等.截止到python版本3.6.2,现在python一共为 ...
- beetl的内置函数 (如strutil 工具类)
转自:http://ibeetl.com/guide/ 2.19. 函数调用 Beetl内置函数请参考附录,以下列出了常用的函数 date 返回一个java.util.Date类型的变量,如 date ...
- 总结day13 ----内置函数
内置函数 我们一起来看看python里的内置函数.什么是内置函数?就是Python给你提供的,拿来直接用的函数,比如print,input等等.截止到python版本3.6.2,现在python一共为 ...
- python 基础篇 15 内置函数和匿名函数
------------------------>>>>>>>>>>>>>>>内置函数<<< ...
- Python笔记_第四篇_高阶编程_再议装饰器和再议内置函数
1. 概述: 我们在前面用了很多的装饰器这个工具的方法.这个位置要系统的讲一下装饰器. 1.2 为什么需要装饰器. 装饰器本质是一个Python函数,它可以让其他函数在不需要任何代码变动的前提下增加额 ...
随机推荐
- python-网络-udp
python-网络-udp 标签(空格分隔): python 开发环境:windows Pycharm+python3.* 工具:网络调试助手 UDP[client]-发送数据 from socket ...
- 机器学习规则:ML工程最佳实践----rule_of_ml section 3【翻译】
作者:黄永刚 ML Phase III: 缓慢提升.精细优化.复杂模型 第二阶段就已经接近结束了.首先你的月收益开始减少.你开始要在不同的指标之间做出平衡,你会发现有的涨了而有的却降了.事情变得有趣了 ...
- SpringMVC后台使用对象接受参数字符串转日期
在springMVC配置文件中加入: <bean id="dateConvert" class="com.iomp.util.DateConvert"/& ...
- 双列集合Map的嵌套遍历
双列集合Map的嵌套使用,例如HashMap中还有一个HashMap,这样的集合遍历起来稍微有点儿复杂.例如一个集合:HashMap<Integer,HashMap<String,Inte ...
- PostgreSQL Replication之第四章 设置异步复制(6)
4.6 有效的清理和恢复结束 最近几年, recovery.conf 已经变得越来越强大了.早在初期(在 PostgreSQL 9.0之前), 仅有 restore_command 和一些 recov ...
- LinkedList源码学习
链表数据结构 当前节点会保存上一个.下一个节点. 参见 LinkedList的Node类 实现: 1. 内部链表的方式. 1.1 添加元素.追加的方式,创建一个新的节点[Node],用最后一个节点关联 ...
- Linux Shell脚本编程-基础2
命令退出状态码 bash每个命令,执行状态都有返回值 0表示成功 非0表示失败(1-255) $?特殊变量可以打印出上一条命令的状态返回值 脚本的状态返回值是脚本执行的最后一条命令 自定义脚本状态返 ...
- 网络编程select函数
select函数的作用: 在编程的过程中,经常会遇到许多阻塞的函数,好像read和网络编程时使用的recv, recvfrom函数都是阻塞的函数,当函数不能成功执行的时候,程序就会一直阻塞在这里,无法 ...
- 08-for循环
- KVM硬件辅助虚拟化之 EPT in Nested Virtualization
在嵌套虚拟环境(Nested Virtualization)下,执行在hypervisor上的Virtual Machine仍能够作为hypervisor去执行其他的Virutal Machine,而 ...