테스트 사이트 - 개발 중인 베타 버전입니다

게시글 엑셀 다운 문의 입니다./ 채택완료

연탄집개 4년 전 조회 3,413

아래코드는 

엑셀로 다운로드 하는데 . wr_content 테그도 같이 다운로드 하고 싶습니다.

어떻게 해야 할까요? 

</p>

<p><td class='txt'>".get_text(strip_tags($data['wr_content']))."</td></p>

<p>

 

 

 

또 해당 게시글에 첨부파일이 있는경우 첨부 파일이 있다 파일명은 어떤건지 까지 내려 받을수있을까요? 

아래는 엑셀 다운받으로고 검색해서 만든 소스 전체 입니다.

 

 </p>

<p><?php

include_once "_common.php";

if (!$is_admin) {

    alert("관리자만 접근 가능합니다.");

    exit;

}</p>

<p>$excel_down = $g5['write_prefix'] . $_GET['bo_table']; //엑셀 다운로드 테이블

$wr_id = $_GET['wr_id'];</p>

<p>$hp_filename = "파일명";

//@sql_query("SET CHARACTER SET utf8");  // 한글깨지면 주석해지</p>

<p>if ($ms =="excel"){

    $g5['title'] = "엑셀 문서 다운로드";

    header( "Content-type: application/vnd.ms-excel" );

    header( "Content-Disposition: attachment; filename={$hp_filename}.xls" );

    //header( "Content-Description: PHP4 Generated Data" );

} else if ($ms =="power"){

    $g5['title'] = "파워포인트 문서 다운로드";

    header( "Content-type: application/vnd.ms-powerpoint" );

    header( "Content-Disposition: attachment; filename={$hp_filename}.ppt" );

    // header( "Content-Description: PHP4 Generated Data" );

} else if ($ms =="word"){

    $g5['title'] = "워드 문서 다운로드";

    header( "Content-type: application/vnd.ms-word" );

    header( "Content-Disposition: attachment; filename={$hp_filename}.doc" );

    //header( "Content-Description: PHP4 Generated Data" );

} else if ($ms =="memo"){

    $g5['title'] = "메모 문서 다운로드";

    header( "Content-type: application/vnd.ms-notepad" );

    header( "Content-Disposition: attachment; filename={$hp_filename}.txt" );

} else {

    header( "Content-type: application/vnd.ms-excel" );

    header( "Content-Disposition: attachment; filename={$hp_filename}.xls" );

}

header( "Content-Description: PHP4 Generated Data" );</p>

<p>// 원글 + 코멘트 다운로드

$temp=sql_fetch_array(sql_query("select count(*) from {$excel_down} "));

$result=sql_query("select * from {$excel_down} order by wr_datetime desc");</p>

<p>// 원글만 다운로드 (코멘트 제외) ,  2013-10-21 추가

//$temp=sql_fetch_array(mysql_query("select count(*) from {$excel_down} where wr_is_comment = '0' and wr_content = '{$wr_id}' "));

//$result=sql_query("select * from {$excel_down} where wr_is_comment = '0'  and wr_content = '{$wr_id}' order by wr_datetime desc"); </p>

<p>$number=$temp[0];

?>

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

<style type="text/css">

.txt {mso-number-format:'\@'}

</style>

</head></p>

<p><body>

<table>

    <tr>

        <td>번호</td>

        <td>제목</td>

        <td>아이디</td>

        <td>이름</td>

        <td>작성일</td>

        <td>내용</td>

        

        <td>필드1</td>

        <td>필드2</td>

        <td>필드3</td>

        <td>필드4</td>

        <td>필드5</td>

        <td>필드6</td>

        <td>필드7</td>

        <td>필드8</td>

        <td>필드9</td>

        <td>필드10</td>

    </tr></p>

<p><?php

while($data=sql_fetch_array($result)) {

    echo "

    <tr>

        <td>{$number}</td>

        <td>{$data['wr_subject']}</td>

        <td>{$data['mb_id']}</td>

        <td>{$data['wr_name']}</td>

        <td class='txt'>{$data['wr_datetime']}</td>

        <td class='txt'>".get_text(strip_tags($data['wr_content']))."</td>

        

        <td class='txt'>{$data['wr_1']}</td>

        <td class='txt'>{$data['wr_2']}</td>

        <td class='txt'>{$data['wr_3']}</td>

        <td class='txt'>{$data['wr_4']}</td>

        <td class='txt'>{$data['wr_5']}</td>

        <td class='txt'>{$data['wr_6']}</td>

        <td class='txt'>{$data['wr_7']}</td>

        <td class='txt'>{$data['wr_8']}</td>

        <td class='txt'>{$data['wr_9']}</td>

        <td class='txt'>{$data['wr_10']}</td>

    </tr>

    ";

    $number--;

}

?>

</table>

</body>

</html></p>

<p> </p>

<p>

 

댓글을 작성하려면 로그인이 필요합니다.

답변 3개

채택된 답변
+20 포인트
Big1
4년 전

strip_tags

지워보세요

get_text(strip_tags($data['wr_content']))

로그인 후 평가할 수 있습니다

댓글을 작성하려면 로그인이 필요합니다.

4년 전

첨부화일 구하는 것은 common.lib.php --> get_file() 함수보면 알 수 있어요

 

로그인 후 평가할 수 있습니다

댓글을 작성하려면 로그인이 필요합니다.

https://phpspreadsheet.readthedocs.io/" ping="/url?sa=t&source=web&rct=j&url=https://phpspreadsheet.readthedocs.io/&ved=2ahUKEwii5d6UgdzvAhVU_J4KHeVJBmkQFjAAegQICRAD" rel="noopener" target="_blank">PhpSpreadsheet

추천하는 excel 관련 라이브러리입니다.

https://phpspreadsheet.readthedocs.io/en/latest/

php에서 엑셀관련 라이브러리는 이게 최고인 거 같습니다.

로그인 후 평가할 수 있습니다

댓글을 작성하려면 로그인이 필요합니다.

답변을 작성하려면 로그인이 필요합니다.

로그인