1
於是我就用整齊很好地格式化HTML:HTML tidy - 刪除標籤之間的空格?如何扭轉「整理」?
$html = 'one line html with many tags';
$config = array(
'indent' => true,
'indent-spaces' => 2,
'show-body-only' => true,
'wrap' => 0
);
$tidy = new \Tidy;
$tidy->parseString($html, $config, 'utf8');
$tidy->cleanRepair();
//this outputs tidied version
echo (string)$tidy;
那麼這個整理的版本傾入其中,用戶編輯的東西,將保存HTML塊ACE編輯器。所以,當我保存它時 - >我希望它是「未被修改」的,這意味着它不應該包含換行符或標記縮進。我將如何做到這一點整齊?