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函数,它可以让其他函数在不需要任何代码变动的前提下增加额 ...
随机推荐
- android页面布局(listview填充中间)
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android=&q ...
- VS导出方法名和方法备注的方法
VS导出方法名和方法备注的方法 方法一: 只能导出图片格式的UML 类图 1.点击查看类图 2.在空白处点击讲关系导出为图像 方法二: 是把整个类库的方法名都罗列出来 这个方便整理一些 具体方法如下 ...
- MyBatis+mysql查询和添加数据
项目结构: Menu package com.mstf.dao; import java.util.Scanner; import org.apache.ibatis.session.SqlSessi ...
- PostgreSQL备份与还原
物理备份:整个数据库的数据目录及文件做备份:备份整个数据库的文件系统. 物理恢复:恢复整个数据库的文静系统. 物理备份方法: 开启归档 select pg_start_backup('backup—— ...
- Monad的基本运算
A monad is created by defining a type constructor M and two operations, bind and return (where retur ...
- vue下载模板、导出excle
1.下载模板是 下载模版比较简单,就是跳一个新的页面 2.导出excle 就是get请求,把自己要导出的参数一一拼接起来 }
- js实现简易打点计时器
很简单的实现一个打点计时器,规定从start至end,每次加1,每次打印间隔100ms,并且返回取消方法. 代码如下: //打点计时器,每间隔100毫秒+1 function count(start, ...
- [POI2009]KON-Ticket Inspector(二维前缀和+DP)
题意 有n个车站,现在有一辆火车从1到n驶过,给出aij代表从i站上车j站下车的人的个数.列车行驶过程中你有K次检票机会,所有当前在车上的人会被检票,问最多能检多少个不同的人的票 (n<=600 ...
- spring-data-jpa 新增 修改 删除 查询 分页
1.查询所有数据 findAll() 2.分页查询 findAll(new PageRequest(0, 2)) 3.根据id查询 findOne() 4.根据实体类属性查询: findByPro ...
- dstat---统计磁盘,CPU,IO,等相关信息
dstat命令是一个用来替换vmstat.iostat.netstat.nfsstat和ifstat这些命令的工具,是一个全能系统信息统计工具.与sysstat相比,dstat拥有一个彩色的界面,在手 ...