剛剛把一個簡單的 php 範例改成我要的方式(跟原本的差不多啦!)


fp = fopen ("sections.dat","r");

if (!fp) {echo "

Unable to open remote file.

"; exit;}

while (!feof(fp)):
line = fgets(fp, 2048);
out = array(line);
list (id, name, description, language, directory, id_uplevel, order, hassubsection) = split ("\", out[0]);
echo "id-name-description-language-directory-
id_uplevel-order-hassubsection
\n";
fp++;
endwhile;

fclose(fp);
?>

來源:
http://tw2.php.net/manual/en/function.fscanf.php

主要的程式碼:
split ("\", out[0])
用來切開欄位的函式
文章標籤
全站熱搜
創作者介紹
創作者 tern 的頭像
tern

毓林園地

tern 發表在 痞客邦 留言(0) 人氣(594)