我是第一次使用 stream_get_content。一切似乎都正常,直到我第二次尝试从流中读取内容。
如果传递给 stream_get_content 的值重复,返回空值!?
但如果我的值(value)不是重复一切都很好!!!!
public function makeAvatar($value)
{
$file_result = "data:image/gif;base64,";
$file_result .= base64_encode(stream_get_contents($value));
return $file_result;
}
最佳答案
您可以使用 rewind()将指针重置为流的开头。
关于php - Stream_get_contents 第二次不起作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24533214/