【发布时间】:2014-05-13 14:13:59
【问题描述】:
我试过了:
$temp = tmpfile();
file_put_contents($temp,file_get_contents("$path/$filename"));
但我收到此错误:“警告:file_put_contents() 期望参数 1 为字符串,”
如果我尝试:
echo file_get_contents("$path/$filename");
它以长字符串形式返回屏幕文件内容。 我哪里错了?
【问题讨论】:
-
tmpfile — Creates a temporary file并返回一个文件指针而不是字符串 -
使用
tempnam而不是tmpfile,它返回字符串文件名而不是资源。 -
我在想参数列表是从零开始的
标签: php temporary-files