Php is the simplest file processing method. -Php Tutorial

Source: Internet
Author: User
Php is the simplest file processing method.
1
 4 567Bob's Auto Parts-Customer Orders8910 Bob's Auto Parts11 Customer Orders12 13
 Isn' t double

"; 18 echo gettype ($ ).'
'; 19 settype ($ a, 'double'); 20 echo gettype ($ ).'
'; 21 */22 23 @ $ fp = fopen ("$ DOCUMENT_ROOT/orders/orders.txt", 'RB'); 24 if (! $ Fp) {25 echo"

No orders pending.26 please try again later.

"; 27 exit; 28} 29 30/* 31 isset (); 32 33 empty () 34 35 */36 // read each line 37 while (! Feof ($ fp) {38 $ order = fgets ($ fp, 1024); // each time fgets () reads a row, it ends with \ n, eof, or 998b. The default value is 1 k = 1024b39 echo $ order ."
"; // Fgetss () is the same as fgets (), but can filter out the 40 tags containing php and html} // fgetss (resource fp, int length, string [allowable_tags]) put the unfiltered tags in allowable_tags 41 // $ order = fgetss ($ fp, 999 ,"

,
"); 42 // fgetcsv ($ fp, 1024," \ t ") means reading the entire file with a line break of 43 44/* 45, 46 readfile ("$ DOCUMENT_ROOT/orders/orders.txt"); 47 fpassthru ($ fp ); // fp is a pointer of 48 $ filearray = file ("$ DOCUMENT_ROOT/orders/orders.txt") 49 // The function is the same as readfile, however, each row is an element of the string array 50 */51 52/* 53, and the entire file 54 while (! Feof ($ fp) 55 $ char = fgetc ($ fp); 56 if (! Feof ($ fp) 57 echo ($ char = "\ n "?
: $ Char); 58 */59 // fread ($ fp, int length) read arbitrary length, or to eof 60 61/* 62 file_exists ("$ DOCUMENT_ROOT/orders/orders.txt"); 63 filesize (); 64 unlink ("$ DOCUMENT_ROOT/orders/orders.txt ") // delete a file 65 66 rewind ($ fp); // repeat the start pointer 67 fseek ($ fp); // locate the position of 68 ftell ($ fp ); // display position 69 70 71 */72 73?> 74

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.