php Code cắt chuỗi làm trích dẫn trong tiêu đề hoặc bài viết

Leave a Comment
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-%

0 nhận xét:

Đăng nhận xét

Tổng số lượt xem trang