gpt4 book ai didi

php - vfsstream : file_get_contents() failed to open stream: stream_open call failed

转载 作者:行者123 更新时间:2023-12-04 17:29:17 33 4
gpt4 key购买 nike

我已经设置了一个 vfsstream block 设备,我正在尝试对其调用 file_get_contents()。然而,对 vfsStreamWrapper::stream_open 的调用失败,因此无法打开流。

这是我的代码:

$this->root = vfsStream::setup('root');
$this->root->addChild(new vfsStreamBlock('test_block_device'));
$this->root->addChild(new vfsStreamFile('not_block_device'));
echo file_get_contents('vfs://root/test_block_device/size');

这里是错误:

file_get_contents(vfs://root/test_block_device/size): failed to open stream: "org\bovigo\vfs\vfsStreamWrapper::stream_open" call failed

Here is the closest issue I've found on this

然而,他的问题是 phpunit 的拆卸问题,而我的问题发生在测试中期。

最佳答案

从文档来看,您似乎需要在读取 block 设备之前向 block 设备添加一些内容:https://github.com/mikey179/vfsStream/wiki/BlockDevices

关于php - vfsstream : file_get_contents() failed to open stream: stream_open call failed,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28301884/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com