为了账号安全,请及时绑定邮箱和手机立即绑定

也许我们可以这样

<?php

/**

 * Created by PhpStorm.

 * User: leifeng

 * Date: 2018/8/8

 * Time: 15:52

 */

 

 //自动创建test文件

$document_root = $_SERVER['DOCUMENT_ROOT'];

echo $document_root.'<br>';

$fp = fopen("$document_root/test.txt",'wb');

$str = "this is a test file.\r\n";

fwrite($fp,$str,strlen($str));

fclose($fp);


$fp = fopen("$document_root/test.txt",'rb');

while (!feof($fp)){

    $order = fgets($fp);//读取一行

    echo "$order";

}

fclose($fp);


正在回答

3 回答

tql

0 回复 有任何疑惑可以回复我~

o(* ̄︶ ̄*)o

0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消
PHP进阶篇
  • 参与学习       181676    人
  • 解答问题       2575    个

轻松学习PHP中级课程,进行全面了解,用PHP快速开发网站程序

进入课程

也许我们可以这样

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信