Code đuợc dùng để rút ngắn bớt khi nội dung quá dài
function thunho($noidung,$num){$limit = $num - 1 ;$str_tmp = '';$arrstr = explode(" ", $noidung);if ( count($arrstr) <= $num ) { return $noidung; }if (!empty($arrstr)) {for ( $j=0; $j< count($arrstr) ; $j++) {$str_tmp .= " " . $arrstr[$j];if ($j == $limit){ break; }}}return $str_tmp.'...';}
nguồn
http://dwebvn.com/forum/showthread.php?730-%
No comments:
Post a Comment