<form id="55n5d"></form>
    <form id="55n5d"></form> <noframes id="55n5d">

    <em id="55n5d"><address id="55n5d"></address></em>

        <form id="55n5d"></form>

        php清除網頁中的空格方法

        php by 黃業興 at 2020-04-03

        今天做了個采集的功能需要去除網頁的空格看代碼:

        public function clear_html($string){
            $str = trim($string); //清除字符串兩邊的空格
            $str = preg_replace("/\t/","",$str); //使用正則表達式替換內容,如:空格,換行,并將替換為空。
            $str = preg_replace("/\r\n/","",$str);
            $str = preg_replace("/\r/","",$str);
            $str = preg_replace("/\n/","",$str);
            $str = preg_replace("/ /","",$str);
            return trim($str); //返回字符串
        }
        

        去除空格之后就可以用正則匹配內容!

        請關注我們微信公眾號:mw748219


        永久免费看A片无码网站宅男

          <form id="55n5d"></form>
          <form id="55n5d"></form> <noframes id="55n5d">

          <em id="55n5d"><address id="55n5d"></address></em>

              <form id="55n5d"></form>