else if($act=="editContent"){
//修改文件内容
//echo "修改文件!";
$content=file_get_contents($filename);
//echo $content;
$str=<<<EOF
<form action="index.php?act=doEdit" method="post">
<textarea name="txt" cols="190" rows="10">{$content}</textarea>
<input type='hidden' name='filename' value='{$filename}'/>
<input type="hidden" name="path" value="{$path}" />
<button type="submit">修改文件内容</button>
</form>
EOF;
echo $str;
}else if($act=="doEdit"){
//修改文件内容的操作
$content=$_REQUEST['txt'];
//echo $content;
if(file_put_contents($content,$filename)){
$msg="文件修改成功!";
}else{
$msg="文件修改失败!";
}
alertMsg($msg,$redirect);
}
?>
你的file_put_contents($content,$filename)里面的参数传反了,仔细点哦