<html>
<head>
    <title>

    </title>
</head>
<body>
    <span>写入数据到文件</span>
    <p>正在写入文件...</p>
    <?php
        $file_name = 'filetest.txt';
        $content = "虾米大王测试用的文字,我是一名php码农。\r\n";

        if(!$handle = fopen($file_name,'a+'))
        {
            echo "不能打开文件$handle"."<br>";
            exit;
        }
        else
        {
            if(fwrite($handle,$content) === false)
            {
                echo "不能写入到文件$handle"."<br>";
                exit;
            }
            else
            {
                echo "文件内容写入成功!"."<br>";
            }


        }
        fclose($handle);
    ?>
</body>
</html>