YesYo.com MintState Forums
뒤로    YesYo.com MintState BBS > Tech > PHP
검색
멤버이름    오토
비밀번호 
 

[Funtion] 글자를 자르는 함수

페이지 정보

작성자 MintState 댓글 0건 조회 10,322회 작성일 08-11-03 10:49

본문

[Funtion] 글자를 자르는 함수

// 글자를 자르는 함수
function Cut_text($str,$max) {

		$string = stripslashes($str);           // 내용 

		$count = strlen($string); 
		
		if($count > $max) { //문자열의 길이가 10 보다 크면
			for ($pos=$max;$pos>0 && ord($string[$pos-1])>=127;$pos--); 
				if (($max-$pos)%2 == 0) { 
					$string = substr($string, 0, $max);
					$string = $string."...";
				} else { 
					$string = substr($string, 0, $max+1);
					$string = $string."...";
				}
			} 
		else { 
			$string = "$string"; 
		}
			
		return $string;
	}

댓글목록

등록된 댓글이 없습니다.

Total 165건 7 페이지
게시물 검색
모바일 버전으로 보기
CopyRight ©2004 - 2024, YesYo.com MintState. ™