也是为了抓取用下的。呵呵!估计到时候可以用了,要把这些整到一个文件下去。呵呵
<?php
function strcut($allStr,$star,$end){
 $starLen=strlen($star);
 $starInt="";
 $endInt="";
 $starInt=strpos($allStr,$star);
 if(empty($starInt)){
  return "error starInt";
  exit;
 }else{
  $starInt=$starInt+1+$starLen;
  $endInt=strpos($allStr,$end,$starInt);
  if(empty($endInt)){
   return "error endInt";
   exit;
 }
 else{
  $allLength=$endInt-$starInt;
  return substr($allStr,$starInt,$allLength);
  }
 }
}
?>


-------------------------------------------
正则表达式
function strcut($allStr,$star,$end){ //截取两个字符之间的字符串,返回字符串
 //if($allStr==""):return false;endif;
 eregi("".$star."(.*)".$end."", $allStr, $head);
 $head[0]=str_replace("".$star."","",$head[0]);
 $head[0]=str_replace("".$end."","",$head[0]);
 return $head[0];
}

相关文章:

  • 2021-10-09
  • 2021-08-04
  • 2022-12-23
  • 2021-09-15
  • 2022-12-23
  • 2021-10-09
  • 2021-06-08
  • 2021-09-20
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-10-09
  • 2021-10-30
  • 2021-07-05
  • 2021-08-22
相关资源
相似解决方案