Quick actions

cmd+k|ctrl+k

Navigation

Languages

php实施修改文件内容/html实施读取文件内容

Snippet info

Language

Php

Visibility

public

Author

mosi

Created

2018-11-24T16:11:56Z

Updated

2018-11-24T16:12:24Z

<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2016/9/10 0010
 * Time: 20:27
 */
header("Content-type: text/html; charset=gbk");
if(isset($_POST['subbtn'])){//如果提交,就开始执行操作
    //执行修改:
    $fileContent=$_POST['fileContent'];//获取输入框的内容
    file_put_contents("a.txt", $fileContent);//执行替换
    echo '修改内容成功!';
}else
    echo '修改内容失败!';

?>

<form method="post" action="">
    <textarea name="fileContent" cols="100" rows="8">
        <?php echo file_get_contents("a.txt") ?>
    </textarea>
    <button name="subbtn">修改内容</button>
</form>
INFO