php通過兩層過濾獲取留言內(nèi)容的方法
來源:易賢網(wǎng) 閱讀:667 次 日期:2016-08-16 14:43:15
溫馨提示:易賢網(wǎng)小編為您整理了“php通過兩層過濾獲取留言內(nèi)容的方法”,方便廣大網(wǎng)友查閱!

本文實例講述了php通過兩層過濾獲取留言內(nèi)容的方法。分享給大家供大家參考,具體如下:

//兩層過濾,獲取留言的內(nèi)容

$str='<div id="read_111111" style="font-size:14px;line-height:150%;padding:10px;">測試文字1<div id="lwd_12223"><h6 class="quote"><span class="s3 f12 fn">樓主留言:</span></h6><blockquote class="blockquote">測試文字2..</blockquote></div></div>';

//$str='<div id="read_111111" style="font-size:14px;line-height:150%;padding:10px;">厲害</div>';

//preg_match("/[^.*](style=\"font-size:14px;line-height:150%;padding:10px;\">)(.*)<\/div>.*$/",$str, $str_arr);

preg_match("/[^.*]id=\"read_[0-9]{8}\" (style=\"font-size:14px;line-height:150%;padding:10px;\">)(.*)<\/div>.*$/",$str, $str_arr); //修復一下過濾樓主的留言

//print_r($str_arr);

if($str_arr[1]=="style=\"font-size:14px;line-height:150%;padding:10px;\">"){

  echo "find!";

  //<div id="

  $str_arr_2=$str_arr[2];

  $str_arr_2_arr=explode("<div id=\"",$str_arr_2);

  $str_arr_2_arr_0=$str_arr_2_arr[0];

  }else{

    //echo "not find!";

  }

echo $str_arr_2_arr_0;

希望本文所述對大家PHP程序設計有所幫助。

更多信息請查看網(wǎng)絡編程
易賢網(wǎng)手機網(wǎng)站地址:php通過兩層過濾獲取留言內(nèi)容的方法
關于我們 | 聯(lián)系我們 | 人才招聘 | 網(wǎng)站聲明 | 網(wǎng)站幫助 | 非正式的簡要咨詢 | 簡要咨詢須知 | 加入群交流 | 手機站點 | 投訴建議
工業(yè)和信息化部備案號:滇ICP備2023014141號-1 云南省教育廳備案號:云教ICP備0901021 滇公網(wǎng)安備53010202001879號 人力資源服務許可證:(云)人服證字(2023)第0102001523號
聯(lián)系電話:0871-65317125(9:00—18:00) 獲取招聘考試信息及咨詢關注公眾號:hfpxwx
咨詢QQ:526150442(9:00—18:00)版權所有:易賢網(wǎng)