Can I read a .TXT file with PHP?

前端 未结 6 953
遥遥无期
遥遥无期 2020-12-01 21:46

As I start the process of writing my site in PHP and MySQL, one of the first PHP scripts I\'ve written is a script to initialize my database. Drop/create the database. Dro

6条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-01 22:20

    Why you not read php documentation about fopen

     $file = fopen("source/file.txt","r");
      if(!file)
        {
          echo("ERROR:cant open file");
        }
        else
        {
          $buff = fread ($file,filesize("source/file.txt"));
          print $buff;
        }
    

提交回复
热议问题