阿強
Lv 7
阿強 asked in 電腦與網際網路程式設計 · 1 decade ago

ASP程式轉成PHP程式。

因為剛剛學習PHP程式,很多語法不熟,可否幫我將下列ASP程式轉換成PHP程式,並簡單說明一下,謝謝!

<%

Response.Charset = "BIG5"

str=Request.QueryString("str")

Set objFSO = CreateObject("Scripting.FileSystemObject")

FileName="str.log"

Set dbug= objFSO.OpenTextFile(FileName, 8,True)

dbug.WriteLine("URL_Page網頁=["&str&"]時間Time=["&Now()&"]")

strResult=str

response.write(strResult)

%>

2 Answers

Rating
  • 1 decade ago
    Favorite Answer

    <?

    header("content-type:text/html; charset=BIG5");

    $str = $_GET['str'];

    $FileName = "str.log";

    //以下是檔案的讀寫比較不同

    $fop=fopen($FileName,"a ");

    fwrite($fop,"URL_Page網頁=[".$str."]時間Time=[".date("Y-m-d H:i:s")."]\r\n");

    fclose($fop);

    $strResult = $str;

    echo $strResult;

    ?>

    寫入檔案資料最後面有加 \r\n 是讓它換行

    date("Y-m-d H:i:s") 的用法參考這裡

    http://stock.ettoday.com/book/function.php-date.ht...

    參考其他函數

    http://stock.ettoday.com/book/

    大概是這種感覺....

    Source(s):
  • Anonymous
    1 decade ago
Still have questions? Get your answers by asking now.