php - file_exists() 从 phpunit 执行时有效,但不是从网页执行
问题描述
我在网络共享位置上有一个文件,我想用 PHP 以编程方式检查它是否存在。
从 PhpUnit 运行时,它工作正常。我的最小测试是:
public function testBackupFileExists () {
$backup_pname = 'R:\myFolder\mySubFolder\myFile.csv';
$this->assertTrue (file_exists ($backup_pname), "File $backup_pname not found");
}
从我的 localhost 从 Web 界面运行时,file_exists()返回 false...
它们都使用相同版本的 PHP (7.4.1),并且都在同一台机器上执行。我也尝试运行clearstatcache(),但它不起作用。
解决方案
推荐阅读
- java - Java无限while循环,具体程序问题
- firebase - Firebase 函数示例中的 LinkedIn oauth 失败
- c++ - 无法理解三元运算符的用法
- reactjs - 为什么 create-react-app 模板系统将 package.json 条目列入黑名单?
- libreoffice - LibreOffice 如何恢复当前元素
- python - Keras 金融神经网络输入错误:预期 4 维,接收输入形状 (1172, 1, 5)
- sql - PostgreSQL 错误:关系不存在
我在 postgres 中创建了 2 个表,其中一个似乎很好,但另一个返回错误:关系“系列”不存在。这两张表完全一样,除了主键和一些列。似乎是什么问题?当主键不同时,不应该创建表吗?'''
CREATE TABLE Films ( Fid varchar (3) NOT NULL DEFAULT '000' PRIMARY KEY, Uiid varchar (3), FOREIGN KEY (Uii
- python - 将时间增量数组转换为瞬间数组
- azure-data-explorer - Kusto.Cloud.Platform.Utils.UtilsArgumentException 无效的 Kusto 连接方案:'' 使用 API 'Query' 时
- audio - 制作音频均衡器视频