代码:
1.$url = Env::get('root_path').'application/admin/test.txt'; //定义创建路径
$file = fopen($url,"w");
$content = "这是条测试数据";
fwrite($file,$content);
fclose($file);

2.$path = './'.$data['appoint_sn'].'.txt'
 $content = "这是一条测试数据";
 // 向文件追加写入内容
// 使用 FILE_APPEND 标记,可以在文件末尾追加内容
// LOCK_EX 标记可以防止多人同时写入
 //PHP_EOL表示不同系统下的换行

file_put_contents($path,$content.PHP_EOL,FILE_APPEND | LOCK_EX)

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-01-10
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-11-12
  • 2022-12-23
  • 2021-11-01
  • 2021-05-18
  • 2022-01-27
  • 2022-02-25
相关资源
相似解决方案