php - fopen() 使用 Vfs 失败,'无法打开流:“org\bovigo\vfs\vfsStreamWrapper::stream_open”'
问题描述
使用 vfsStream,我正在向 vfs 写入一个文件,我可以读取它的内容:
$vfsRoot = \org\bovigo\vfs\vfsStream::setup('root');
$vfsRoot->addChild(\org\bovigo\vfs\vfsStream::newDirectory('mydir'));
$directory = \org\bovigo\vfs\vfsStream::url('root/mydir');
file_put_contents("vfs://root/mydir/test.txt", 'test!!');
$contents = file_get_contents("vfs://root/mydir/test.txt");
一切正常——如果我 dump($contents) 我看到了我的期望。
但是,这样做会导致警告:
$fp = fopen("vfs://root/mydir/test.txt", "rw+");
警告:fopen(vfs://root/mydir/test.txt):无法打开流:“org\bovigo\vfs\vfsStreamWrapper::stream_open”调用失败
我究竟做错了什么?
解决方案
推荐阅读
- python - 为正则表达式添加额外的命名组
- ios - 如何提高 UITableView 的性能
- javascript - 子域上 iframe 中的 chrome recaptcha allowall
- c++ - 执行时资源不足
- azure - 将测试结果发布到 Azure(VS 数据库项目、tSQLt、Azure Pipelines、Docker)
- node.js - 中止安装。yarnpkg add --exact react react-dom react-scripts cra-template --cwd /home/ficho/workspace/storybook-tutorial 失败
- javascript - 实现 JavaScript 回调
- python - 我对 kivy 很陌生,我和 Tim 一起关注了这个名为 Tech 的 youtuber,以下发生在他的 Kivy 教程 #4 之后
- list - 如何将一个类的多个对象引用添加到颤动的列表中?
- javascript - 更改与“单选按钮检查”相关的 src