PHP file Operation steps

Source: Internet
Author: User
Tags fread

Add Utf-8 in PHP:

1 header("content-type:text/html;charset= ' UTF-8 '");

File operation steps:

1. Create a file.txt folder in the same directory

2. Open File

1 $res = fopen("file.txt", "R"); // Open File path, open after is a resource, need further processing;//R is read-only meaning

3. Reading files

$str fread ($res, 300); // The second parameter is the length of the read (3 for each kanji) $str fread ($res,filesize("file.txt")); // filesize Read File size//above select one to display Echo $str;

4. Close the file

fclose ($res); // when you have finished reading, close the resource

PHP file Operation steps

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.