출력되는 글자수를 자르고 싶습니다

출력되는 글자수를 자르고 싶습니다

QA

출력되는 글자수를 자르고 싶습니다

본문

아래문장에서 {$list[$i][lo_url]}​ <---- 출력되는 글자수를 자르고 싶습니다

도움 부탁드립니다

 

 

 if ($list[$i][lo_url] && $is_admin == "super")

        echo "<td colspan=2> <a href='{$list[$i][lo_url]}' target='_blank'>{$location}<br>{$list[$i][lo_url]}</a><br><br></td>";

    else

        echo "<td colspan=2> {$location}</td>";

 

    echo 

이 질문에 댓글 쓰기 :

답변 5

아래 붉은색 부분만 기존 코드 상단에 추가해 주시면 됩니다.^^

 

$list[$i][lo_url] = cut_str($list[$i][lo_url]​,30);​ // 자르려는 글자수에 맞게 '30' 숫자를 조정해 보세요.

 

if ($list[$i][lo_url] && $is_admin == "super")

        echo "<td colspan=2> <a href='{$list[$i][lo_url]}' target='_blank'>{$location}<br>{$list[$i][lo_url]}</a><br><br></td>";

    else

        echo "<td colspan=2> {$location}</td>"; 

참고하세요 

http://php.net/manual/kr/function.mb-substr.php 

 

(PHP 4 >= 4.0.6, PHP 5) 이니 

4.0.6이하버전이시라면 

substr을 쓰세요 <--- 이놈은 2바이트 문자를 인식하지 못합니다.​

오류 발생하는 해당 페이지의 30라인 코드를 올려주세요.^^

아래문장중 아래문구부분 입니다^^
$list[$i][lo_url] = ​cut_str($list[$i][lo_url]​,30);​  <-------- 30라인


<?
for ($i=0; $i<count($list); $i++)
{
    echo <<<HEREDOC
    <tr>
        <td colspan=3 align='center' height='30'>{$list[$i][num]}</td>
        <td colspan=2 align='center'>{$list[$i][name]}</td>
HEREDOC;

    $location = conv_content($list[$i][lo_location], 0);
$list[$i][lo_url] = ​cut_str($list[$i][lo_url]​,30);​    <--------- 30라인
    // 최고관리자에게만 허용
    // 이 조건문은 가능한 변경하지 마십시오.
    if ($list[$i][lo_url] && $is_admin == "super")
        echo "<td colspan=2>&nbsp;<a href='{$list[$i][lo_url]}' target='_blank'>{$location}<br>{$list[$i][lo_url]}</a><br><br></td>";
    else
        echo "<td colspan=2>&nbsp;{$location}</td>";

    echo <<<HEREDOC
    </tr>
    <tr><td colspan='7' height='1' background='{$connect_skin_path}/img/dot_bg.gif'></td></tr>
HEREDOC;
}

답변을 작성하시기 전에 로그인 해주세요.
전체 44
QA 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1404호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT