問題描述
在安裝在 Windows XP 計算機上的 PHP (XAMPP) 中我試圖讀取本地網絡服務器上存在的目錄.我使用 is_dir()
來檢查它是否是我可以讀取的目錄.
within PHP (XAMPP) installed on a Windows XP Computer Im trying to read a dir which exists on a local network server. Im using is_dir()
to check whether it is a dir that I can read.
在 Windows 資源管理器中,我輸入 \serverdir
并顯示該目錄.當我映射網絡驅動器時,也可以使用 z:dir
訪問它.
In Windows Explorer I type \serverdir
and that dir is being shown.
When I map a network drive a can access it with z:dir
as well.
在 PHP 中我有那個腳本:
In PHP I have that script:
<?php if( is_dir($dir){ echo 'success' } ) ?>
對于 $dir
我試過:
/server/dir
//server/dir
serverdir
\serverdir
\\server\dir
和
z:dir
z:\dir
z:/dir
z://dir
但我從來沒有成功過?任何的想法?謝謝
But I never get success? Any idea? thx
推薦答案
我通過更改服務器注冊表中的一些內容解決了這個問題,如本次討論的最后一個答案所述:
I solved it by changing some stuff in the registry of the server as explained in the last answer of this discussion:
http://bugs.php.net/bug.php?id=25805
無論如何都要感謝 VolkerK 和 Gumbo!我喜歡 stackoverflow 和他們很棒的人,他們幫助你的速度非常快!!
Thanks to VolkerK and Gumbo anyway! I love stackoverflow and their great people who help you so incredibly fast!!
編輯(取自 php.net):
EDIT (taken from php.net):
該服務對網絡資源的訪問受限,例如共享和管道,因為它沒有憑據并且必須使用 null 進行連接會議.以下注冊表項包含 NullSessionPipes 和NullSessionShares 值,用于指定管道和空會話可以連接到的共享:HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesLanmanServerParameters或者,您可以添加 REG_DWORD 值RestrictNullSessAccess 鍵值,設置為 0 允許所有空值會話以訪問在該機器上創建的所有管道和共享.`
The service has limited access to network resources, such as shares and pipes, because it has no credentials and must connect using a null session. The following registry key contains the NullSessionPipes and NullSessionShares values, which are used to specify the pipes and shares to which null sessions may connect: HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesLanmanServerParameters Alternatively, you could add the REG_DWORD value RestrictNullSessAccess to the key and set it to 0 to allow all null sessions to access all pipes and shares created on that machine.`
將 RestrictNullSessAccess=0 添加到您的注冊表中.
add RestrictNullSessAccess=0 to your registery.
這篇關于windows下php訪問網絡路徑的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!