![](/img/trans.png)
[英]Trying to open (and create if not exists) file on mapped network drive in PHP
[英]PHP create file in mapped drive directory
嘗試在映射驅動器 (Z:) 中的文件夾中創建文件
我使用的源代碼如下:
$fileNumber = 'F2310XXXX';
$content = "; Test \n; Date : ".date('d/m/Y H:i:s')."\n; Filename : ".$fileNumber.".TXT";
$fp = fopen("//xx.xx.xxx.xxx/MC/".$fileNumber.".TXT","wb");
fwrite($fp,$content);
fclose($fp);
出現以下錯誤:
A PHP Error was encountered
Severity: Warning.
Message: fopen(//xx.xx.xxx.xxx/MC/F2310XXXX.TXT): failed to open stream: Permission denied
Filename: controllers/Auth.php
Line Number: 76
Backtrace:
File: C:\wamp64\www\mc-app\admin\application\controllers\Auth.php
Line: 76
Function: fopen
File: C:\wamp64\www\mc-app\admin\index.php
Line: 315
Function: require_once
請有人幫助解決這個問題,因為我嘗試了幾乎所有的解決方案都從谷歌得到它,但沒有運氣。 您的所有幫助將不勝感激。 提前致謝
如果您知道驅動器號,為什么不指定它呢?
$fp = fopen("Z:/MC/".$fileNumber.".TXT","wb");
沒有它,您將嘗試在默認腳本所在的驅動器上打開該文件。
xx.xx.xxx.xxx 是 IP 地址嗎?
這個問題幾乎毫無疑問是權限問題。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.