psr7的StreamInterface::getContents()应该是返回全部内容吗?

/**
     * Returns the remaining contents in a string
     *
     * @return string
     * @throws \RuntimeException if unable to read or an error occurs while
     *     reading.
     */
    public function getContents();

这里的 remaining contents 指的是不是当前位置之后的内容?

阅读 3.4k
2 个回答

不是返回全部内容,而是流指针之后,如果要获取全部内容,用__toString, 可以参考下 zend-diactoros的实现。

https://github.com/zendframew...

新手上路,请多包涵

->getContent->__toString()

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题