Board logo

標題: [SQL與PHP] php 取得 url/file 的內容 [打印本頁]

作者: gswdkimo    時間: 2011-7-6 08:23     標題: php 取得 url/file 的內容

<?php

$file = "http://www.hinet.net/";

$html = "";

$fo = fopen($file, "r");

while (!feof($fo)) {

    $tmp=fgets($fo);

    if($tmp != null){

        $html .= $tmp;

    )

}

fclose($fo);

echo $html;

?>

說明:

     fgets 一次只讀一行.

     fread 一次讀完整個檔案.





歡迎光臨 資訊家電班NO7 (http://imce07.freehostia.com/forums/) Powered by Discuz! 7.2