在Dreamweaver 中打开functions.php 文件,在代码中:/**
* Replace all whitespace by a space except in <textarea /> and <pre />
*
* @param string $string Source code to compress
* @returns string Compressed source code
*/
function compress_sourcecode($string) {
$matches = array();
preg_match_all("#<textarea.*?>(.*?)</textarea>#is", $string, $matches[0]);
preg_match_all("#<pre.*?>(.*?)</pre>#is", $string, $matches[1]);
preg_match_all("#<script.*?>(.*?)</script>#is", $string, $matches[2]);
$matches = array_merge($matches[0][0], $matches[1][0], $matches[2][0]);
foreach ( $matches as $oldpart ) {
$newpart = str_replace("\n", "\0", $oldpart);
$string = str_replace($oldpart, $newpart, $string);
}
$string = str_replace("\r", "", $string);
$string = preg_replace("#\s+#", ' ', $string);
$string = str_replace("\0", "\n", $string);
return $string;
}
所示部分高亮。应该是代码编辑错误。不知道是什么原因。
求助各位大侠!
* Replace all whitespace by a space except in <textarea /> and <pre />
*
* @param string $string Source code to compress
* @returns string Compressed source code
*/
function compress_sourcecode($string) {
$matches = array();
preg_match_all("#<textarea.*?>(.*?)</textarea>#is", $string, $matches[0]);
preg_match_all("#<pre.*?>(.*?)</pre>#is", $string, $matches[1]);
preg_match_all("#<script.*?>(.*?)</script>#is", $string, $matches[2]);
$matches = array_merge($matches[0][0], $matches[1][0], $matches[2][0]);
foreach ( $matches as $oldpart ) {
$newpart = str_replace("\n", "\0", $oldpart);
$string = str_replace($oldpart, $newpart, $string);
}
$string = str_replace("\r", "", $string);
$string = preg_replace("#\s+#", ' ', $string);
$string = str_replace("\0", "\n", $string);
return $string;
}
所示部分高亮。应该是代码编辑错误。不知道是什么原因。
求助各位大侠!
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货