list. txt

김치, 1000
콩나물, 2000
.
.
.

<?

 $fp = fopen("list.txt" , "r") ;
while(!feof($fp)) $data[] = fgets( $fp , "1024") ; // 한줄씩 list.txt 에서 데이터 추출
$total = count($data); 총 열 갯수
for($i=0 ; $i < $total ; $i++ ) {
  
 $list = explode("," , $data[$i]) ;
    echo " $list[0] 는 $list[1] 원입니다. <br />";
  }
  ?>
Posted by 웹눈

TRACKBACK | http://webnoon.net/trackback/112 관련글 쓰기

댓글을 달아 주세요

  1. BlogIcon 웹눈 2009/04/16 20:49  댓글주소  수정/삭제  댓글쓰기

    <?

    //////////////////////////////////////////////////

    $da = array("김치,1000" , "콩나물,2000") ;


    $total = count($da);
    for($i=0 ; $i<$total ; $i++ ) {

    $list = explode("," , $da[$i]) ;
    echo " $list[0] 는 $list[1] 원입니다. <br />";
    }
    ?>