-
-
/* - Collection and interception function, mainly used to analyze the collected content
- getcon - remove html characters and spaces after interception
- getcon2 - simple interception, directly return the interception content.
- Parameters:
- $par accepts two formats:
- 1. Characters before {DATA} and characters after
- 2. Regular expression
- */
function getcon($pat,$str) {
- $title_var=explode("{DATA}",$pat);
- if(count($title_var)>1){
- $title_1=explode($title_var[0],$str);
- $title_2= explode($title_var[1],$title_1[1]);
- return strip_s(strip_tags($title_2[0]));
- }else{
- preg_match_all($pat,$str,$res);
- return strip_s( strip_tags($res[1][0]));
- }
- }
-
- function getcon2($pat,$str){
- $title_var=explode ("{DATA}",$pat);
- if(count( $title_var)>1){
- $title_1=explode($title_var[0],$str);
- $title_2=explode($title_var[1],$title_1[1]);
- return $title_2[0] ;
- }else{
- preg_match_all($pat,$str,$res);
- return $res[1][0];
- }
- }
-
- function strip_s($str){
- $str = preg_replace ("/ (s+)/", ' ', $str);
- $str = str_replace(chr(13),'',$str);
- $str = str_replace(chr(10),'
',$ str);
- $str = ltrim($str);
- $str = trim($str);
- return $str;
- }
- ?>
-
Copy code
|