欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

php通過兩層過濾獲取留言內容的方法

 更新時間:2016年07月11日 09:26:10   作者:張文君  
這篇文章主要介紹了php通過兩層過濾獲取留言內容的方法,涉及php正則匹配及數(shù)組與字符串的相關操作技巧,需要的朋友可以參考下

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

//兩層過濾,獲取留言的內容
$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;

PS:這里再為大家提供一款非常實用的在線過濾工具:
在線html/js/css代碼過濾工具:
http://tools.jb51.net/code/htmlfilter

更多關于PHP相關內容感興趣的讀者可查看本站專題:《php文件操作總結》、《PHP運算與運算符用法總結》、《PHP網絡編程技巧總結》、《PHP基本語法入門教程》、《php操作office文檔技巧總結(包括word,excel,access,ppt)》、《php日期與時間用法總結》、《php面向對象程序設計入門教程》、《php字符串(string)用法總結》、《php+mysql數(shù)據(jù)庫操作入門教程》及《php常見數(shù)據(jù)庫操作技巧匯總

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

相關文章

最新評論