PHP文件写入报错。

PHP写入文件时创建了新文件(正常),然后提示waring:fwrite() expects parameter 1 to be resource.string given in [PHP文件路径] on [fwrite的那一行],怎么才能正常写入内容
fopen打开方式用的是a

https://stackoverflow.com/questions/34187674/fwrite-expects-parameter-1-to-be-resource-string-given-in-c

fwrite() 函数的第一个参数是文件资源类型,你传的是字符串,所以报错
正确用法:

$fileResource = fopen($filename, 'a+'); // fopen会返回文件资源
$content = "123";
fwrite($fileResource, $content);