<%
list=Request.form("content")
WriteFile("/index.html")
Response.write "更新成功!"'写入文件
Function WriteFile(filename)
set fso=createobject("scripting.filesystemobject")
filepathx=server.mappath(filename)
set f=fso.createtextfile(filepathx,true)
f.writeline(list)
f.close
End Function
%>

解决方案 »

  1.   

    <?php
    if(empty($_POST['content'])) exit('请输入内容');
    if(!function_exists('file_put_contents')) {//php5以后可以把这个if删掉
    function file_put_contents($path, $contents){
    $fp = fopen($path, 'wb');
    if(false === $fp) return false;
    $length = fwrite($fp, $contents);
    if(false === $length) return false;
    fclose($fp);
    return $length;
    }
    }
    if(false === file_put_contents('index.html', $_POST['content'])) exit('请检查目录以及文件权限');
    echo '更新成功!';
    ?>