Remove whitespace from HTML

前端 未结 15 1825
花落未央
花落未央 2020-12-28 14:25

I have HTML code like:

15条回答
  •  清歌不尽
    2020-12-28 14:48

    /', '', $content);
            }
            function sanitize_output($buffer) {
                $search = array(
                    '/\>[^\S ]+/s',  // strip whitespaces after tags, except space
                '/[^\S ]+\',
                 '<',
                 '\\1'
              );
    
              $buffer = preg_replace($search, $replace, $buffer);
              return remove_html_comments($buffer);
            }
            if(COMPRESSOR){ ob_start("sanitize_output"); }
        ?>
    
          
            
              
              Example   1
            
            
               

    This is example

    RESULT: Example 1

    This is example

提交回复
热议问题