日期:2011-12-09  浏览次数:20515 次

  移除 HTML 标签

  1. $text = strip_tags($input""); 
  返回 $start 和 $end 之间的文本
  1. function GetBetween($content,$start,$end){ 
  2.     $r = explode($start$content); 
  3.     if (isset($r[1])){ 
  4.         $r = explode($end$r[1]); 
  5.         return $r[0]; 
  6.     } 
  7.     return ''
  将url转换成链接
  1. $url = "Jean-Baptiste Jung (http://www.webdevcat.com)"
  2. $url = preg_replace("#http://([A-z0-9./-]+)#"'<a href="http://www.catswhocode.com/blog/$1" style="font-size: 12px; vertical-align: baseline; background-color: transparent; margin: 0px; padding: 0px; color: #3777af; text-decoration: none; font-weight: bold">$0</a>'$url); 
  切分字符串为140个字符
  1. function split_to_chunks($to,$text){ 
  2.     $total_length = (140 - strlen($to)); 
  3.     $text_arr = explode(" ",$text); 
  4.     $i=0; 
  5.     $message[0]=""
  6.     foreach ($text_arr as $word){