12 lines
323 B
PHP
12 lines
323 B
PHP
<?php
|
|
$filepath = 'data/test_write';
|
|
$str = '你好世界hello world<br>';
|
|
$resource = fopen($filepath, 'w+b') or die('文件不存在');
|
|
fwrite($resource, $str);
|
|
//rewind($resource);
|
|
//echo htmlspecialchars(fgets($resource));
|
|
fclose($resource);
|
|
readfile($filepath);
|
|
|
|
file_put_contents($filepath,$str);
|
|
readfile($filepath); |