2026, 새로운 도약을 시작합니다.

ep파일이 PHP 파일인데 TXT로 생성해달라는데요. 도와주세요. ㅠㅠ 채택완료

남겨주신 EP파일은 PHP로 작성되었습니다. 

해당 파일은 TXT로 작업 부탁드립니다. 

1028149430_1765180283.2748.png

이렇게 생성을 하라는데요. 다음 처럼 하게되면 될까요?

TXT로 생성을 TEST.TXT로 생성하고요.

소스를 

<?php
include_once('./_common.php');

header("Content-Type: text/html; charset=UTF-8");

// clean the output buffer
ob_end_clean();

/*

에누리쇼핑상품EP 제작및연동가이드 (제휴사제공용)
https://seller.enuri.com/sdul/Sdu_Guide.jsp?view=alliance01

Field                   Status  Notes
id                      필수    판매하는 상품의 유니크한 상품ID
title                   필수    실제 서비스에 반영될 상품명(Title)
price_pc                필수    상품가격
price_mobile            필수    모바일상품가격
link                    필수    상품URL
image_link              필수    해당 상품의 이미지URL
category_name1          필수    카테고리명(대분류)
category_name2          권장    카테고리명(중분류)
category_name3          권장    카테고리명(소분류)
category_name4          권장    카테고리명(세분류)
model_number            권장    모델명                   
brand                   권장    브랜드
maker                   권장    제조사
origin                  권장    원산지                   
event_words             권장    이벤트       
coupon                  권장    일반/제휴쿠폰
interest_free_event     권장    카드 무이자 할부정보
point                   권장    포인트
shipping                필수    배송료
seller_id               권장    셀러 ID (오픈마켓에 한함)
class                   필수(요약)  I (신규상품) / U (업데이트 상품) / D (품절상품)
update_time             필수(요약)  상품정보 생성 시각
*/

$tab = "\t";

ob_start();

echo "id{$tab}title{$tab}price_pc{$tab}price_mobile{$tab}link{$tab}image_link{$tab}category_name1{$tab}category_name2{$tab}category_name3{$tab}category_name4{$tab}model_number{$tab}brand{$tab}maker{$tab}origin{$tab}point{$tab}shipping";

$sql =" select * from {$g5['g5_shop_item_table']} where it_use = '1' and it_soldout = '0' and it_tel_inq = '0' and it_price > '0' order by ca_id";
$result = sql_query($sql);

for ($i=0; $row=sql_fetch_array($result); $i++)
{
    $cate1 = $cate2 = $cate3 = $cate4 = '';
    $caid1 = $caid2 = $caid3 = $caid4 = '';

    $caid1 = substr($row['ca_id'],0,2);
    $row2  = sql_fetch(" select ca_name from {$g5['g5_shop_category_table']} where ca_id = '$caid1' ");
    $cate1 = $row2['ca_name'];

    if (strlen($row['ca_id']) >= 8) {
        $caid4 = substr($row['ca_id'],0,8);
        $row2  = sql_fetch(" select ca_name from {$g5['g5_shop_category_table']} where ca_id = '$caid4' ");
        $cate4 = $row2['ca_name'];
    }

    if (strlen($row['ca_id']) >= 6) {
        $caid3 = substr($row['ca_id'],0,6);
        $row2  = sql_fetch(" select ca_name from {$g5['g5_shop_category_table']} where ca_id = '$caid3' ");
        $cate3 = $row2['ca_name'];
    }

    if (strlen($row['ca_id']) >= 4) {
        $caid2 = substr($row['ca_id'],0,4);
        $row2  = sql_fetch(" select ca_name from {$g5['g5_shop_category_table']} where ca_id = '$caid2' ");
        $cate2 = $row2['ca_name'];
    }

    // 배송비계산
    $delivery = get_item_sendcost2($row['it_id'], $row['it_price'], 1);

    // 상품이미지
    $img_url = get_it_imageurl($row['it_id']);

    // 포인트
    $it_point = get_item_point($row);
    
    // 판매가=판매가-쿠폰할인 금액출력 
    if ($row['it_cust_price2']) {
    $row['it_price'] = $row['it_price'] - $row['it_cust_price2'];
}

    $item_link = G5_SHOP_URL.'/item.php?it_id='.$row['it_id'];

    echo "\n{$row['it_id']}{$tab}{$row['it_name']}{$tab}{$row['it_price']}{$tab}{$row['it_price']}{$tab}{$item_link}{$tab}{$img_url}{$tab}{$cate1}{$tab}{$cate2}{$tab}{$cate3}{$tab}{$cate4}{$tab}{$row['it_model']}{$tab}{$row['it_brand']}{$tab}{$row['it_maker']}{$tab}{$row['it_origin']}{$tab}{$it_point}{$tab}{$delivery}";
}

$content = ob_get_contents();
ob_end_clean();

echo $content;

$fp=fopen('enuri.txt','w');
fwrite($fp, $content);
fclose($fp);
?>

이렇게 넣으면 되는걸까요? TXT로 사용해야된다는데... 이게 맞는지요? 방법 좀 부탁드립니다.ㅠㅠ

그냥 소스로 출력되던데... 이게 맞을까요? 

답변 1개

채택된 답변
+20 포인트

선생님 확장자를 .txt 파일로 하라고하는것 아닙니까? 

하여

enuri.txt  이파일 생성이 되어있어야 하는 데  생성이 안되어 있는 것 같습니다.

하여 디렉터리 쓰기권한이 있는지 확인해보시기 바랍니다.

만약 권한 이상없다면 기본 data 저장을 가지고 있는 폴더안에

텍스트 저장될 파일위치 를 확인하시여

$fp = fopen(G5_PATH.'/data/enuri.txt', 'w'); 이런식으로 절대경로를 써보시기 바랍니다.

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

답변에 대한 댓글 1개

php소스를 달라는게 아니라 결과값을 노출되는걸 달라는거였군요. 감사합니다.
어천지 저는 php소스를 txt에서 열어봤자 소스 그대로 보일텐데 왜 txt로 달라고 하나해서 별도로 소스가 나오는 txt가 존재하나 해서 문의 드렸습니다.
답변 감사합니다. 해당위치에 txt생성완료 되도록 조치했습니다.

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

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

로그인
🐛 버그신고