PHP fgets read strings and explode split strings by line array _php Tutorial

Source: Internet
Author: User

PHP fgets read string and explode split string array by row


File.txt

Type | directory | file | size | creation time

file| C:\Program files\java\jre7\lib\zi\america\indiana| VEVAY|724|2014-10-13 09:36 file| C:\Program files\java\jre7\lib\zi\america\indiana| VINCENNES|884|2014-10-13 09:36file| C:\Program files\java\jre7\lib\zi\america\indiana| WINAMAC|932|2014-10-13 09:36 directory| C:\Program files\java\jre7\lib\zi\america| INDIANA|0|2014-10-13 09:36

readfile.php

 
  "; $str = Explode (" | ", $line);//print_r ($STR); $file _type =  $str [0]; $dir _name =  $str [1]; $file _name =  $str [ 2]; $file _size =  $str [3]; $create _time =  $str [4];echo $file _type;echo "
"Echo $dir _name;echo"
"Echo $file _name;echo"
"Echo $file _size;echo"
"Echo $create _time;echo"
";} Fclose ($f);? >

Results show


http://www.bkjia.com/PHPjc/953329.html www.bkjia.com true http://www.bkjia.com/PHPjc/953329.html techarticle PHP fgets read string and explode split string by line array file.txt Type | directory | file | size | Create Time file| C:\Program files\java\jre7\lib\zi\america\indiana| Veva ...

  • 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.