开发者

localhost: I want my .php to access a folder in another drive

localhost: I want my .php to access a folder in another 开发者_开发百科drive.

At first I thought it could be done with Apache Alias, but now I don't know.

D:/Appserv/www/x/y/file.php

I want that .php to read the contents of:

E:/foldie/


Well, the syntax of the Alias directive is quite straightforward:

Description: Maps URLs to filesystem locations
Syntax:      Alias URL-path file-path|directory-path
Context:     server config, virtual host
Status:      Base
Module:      mod_alias

... and the included example clarifies the rest:

Alias /image /ftp/pub/image

The fact that you've tagged this as PHP suggests that you are either trying to set Alias inside an .htaccess file (which is simply not allowed, it needs to go in the main server config) or misinterpreting the directive as having something to do with file system symlinks (which is not, it only affect HTTP requests).

Just type the full path (with drive letter and all) in whatever PHP function you are trying to use and, if you use back slashes, make sure you double them:

foreach( glob('E:/foldie/*') as $item ){
}
foreach( glob('E:\\foldie\\*') as $item ){
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜