Php 流\u获取\u内容第二次不工作?
我第一次使用流获取内容。在我第二次尝试读取流中的内容之前,一切似乎都正常 如果传递到流_get_内容的“我的值”重复,请返回空值 但如果我的价值观不是重复,一切都是好的Php 流\u获取\u内容第二次不工作?,php,streaming,Php,Streaming,我第一次使用流获取内容。在我第二次尝试读取流中的内容之前,一切似乎都正常 如果传递到流_get_内容的“我的值”重复,请返回空值 但如果我的价值观不是重复,一切都是好的 public function makeAvatar($value) { $file_result = "data:image/gif;base64,"; $file_result .= base64_encode(stream_get_contents($value)); return $file_re
public function makeAvatar($value)
{
$file_result = "data:image/gif;base64,";
$file_result .= base64_encode(stream_get_contents($value));
return $file_result;
}
您可以使用重置指向流开头的指针。我想,当您调用stream_get_contents()时,它从流中读取内容,直到到达EOF,然后句柄(此处为$value)关闭。