PHP Learning Notes: Reading the contents of a document, using PHP to modify the contents of the document

Source: Internet
Author: User

Directly on the code

<?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 '])) {//if committed, start the operation//execute the modification:    $fileContent=$_post[' Filecontent '];//get the contents of the input box    file_put_contents("A.txt",$fileContent);//Perform a replacement    Echo' Modify content successfully! ‘;}Else    Echo' Failed to modify content! ‘;><form method= "POST" action= "" > <textarea name= "filecontent" cols= "rows=" 8 "> <?phpEcho file_get_contents("A.txt")?> </textarea> <button name= "subbtn" > Modify content </button></form>

modifying test effects

Before modification:

After modification:

PHP Learning Notes: Reading the contents of a document, using PHP to modify the contents of the document

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.