PHP 100 實例,第41題。
<HTML> <HEAD> <TITLE>打開本地或者遠程文件</TITLE> </HEAD> <BODY> <? print("<H3>通過http協議打開文件</H3>n"); // 通過 http 協議打開文件 if(!($myFile = fopen("http://xlj/php/jiang/data.txt", "r"))) { print("文件不能打開"); exit; } while(!feof($myFile)) //循環 { // 按行讀取文件中的內容 $myLine = fgetss($myFile, 255); print("$myLine <BR>n"); } // 關閉文件的句柄 fclose($myFile); ?> </BODY> </HTML>
NAME
EMAIL
Website URL
NOTE - You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>