PHPize Online / SQLize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
Copy Clear
Copy Format Clear
<?php function nick_html_压缩_完美版($html) { // 替换除了<style>标签之外的其他标签中的空白字符 $search = array('/(?![^<]*<\/style>)\>[^\S ]+/s', '/[^\S ]+\</s', '/(\s)+/s'); $replace = array('>', '<', '\\1'); $html = preg_replace($search, $replace, $html); return $html; } // 测试 $string = ' <!DOCTYPE html> <html lang="zh-CN"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>开云体育-诺丁汉森林胸前广告赞助商</title> <meta http-equiv="keywords" content="开云体育" /> <meta name="description" content="开云体育(KaiYun Sports),英文名:KaiYun!开云体育成立于2020年12月12日总部在国际商业地带,位置优越。开云体育是汉语消费者市场第一的线下线上娱乐服务供应商,更是全球商业环境一流的线下线上娱乐公司之一!开云体育公司业务涵括真人游戏、虚拟竞技、真人视讯游戏、棋牌对战、抢庄牛牛等,开云体育期待与您携手共同发展壮大!" /> <meta id="viewport" name="viewport" content="width=device-width; initial-scale=1; maximum-scale=1;" /> <link rel="shortcut icon" href="/favicon.ico" /> <link href="/static/css/home.css" rel="stylesheet" /> </head> <body style="background-position: 71.85% 7.1%;"> <div class="sd2b7f7 light-text"> <div class="sw20d3f"> <h1>开云体育</h1> <br /> <div class="logo landing wuc4a6d"> <img src="https://jy1f.com/static/lunbo-1.webp" alt="开云体育" title="开云体育"/> </div> <p2> <h2><strong>开云体育-诺丁汉森林胸前广告赞助商</strong></h2> </p2> <br /> <p class="buttons"> <a class="button dark-bg" href="http://f5yb.com/?source=www.otakunoie.com" target="_blank" rel="nofollow"> 开云体育-电脑网页版</a> <a class="button dark-bg" href="http://f5yb.com/?source=www.otakunoie.com" rel="nofollow"> 开云体育-手机网页版 </a> </p> <p>开云体育(KaiYun Sports),英文名:KaiYun!开云体育成立于2020年12月12日总部在国际商业地带,位置优越。开云体育是汉语消费者市场第一的线下线上娱乐服务供应商,更是全球商业环境一流的线下线上娱乐公司之一!开云体育公司业务涵括真人游戏、虚拟竞技、真人视讯游戏、棋牌对战、抢庄牛牛等,开云体育期待与您携手共同发展壮大!</p> <br /> <h2><strong>开云体育-全站手机应用 实时下载二维码</strong></h2> <div class="wuc4a6d"><img class="wuc4a6d" src="https://jy1f.com/static/jy1f.com-1.png" alt="开云体育" title="开云体育"/></div> <p2><strong></strong></p2> <img src="/static/picture/yabo18.png" alt="开云体育" title="开云体育"/> <br /> <p2> <h2><strong>开云体育-手机应用安装版</strong></h2> </p2> <style> .red { color: red; } .invalid-feedback { color: red; font-size: smaller; } </style> '; $result = nick_html_压缩_完美版($string); echo $result; // 输出:apple, banana, banana, orange, cherry ?>
Show:  
Copy Clear