作者dream1129 ( 人各有志)
看板PHP
标题[请益] 路径问题
时间Sun Mar 12 13:37:42 2006
我再作读档,开档,或是有用到路径的相关东西,常常有 Error,
路径不就是 localhost/xxx/xxx 的那段吗??
例如:
我的档案放在 localhost/practice/images/ 底下,
我的 $current_dir='/pratice/images/';
$dir=opendir($current_dir);
它显示说没有这个路径,我搞不清楚是要用斜线/,还是反斜线\,
我记得书上好像是说 windows可以辨识斜线跟反斜线,但是unix只能辨识斜线。
我的OS是视窗的,但是我用斜线跟反斜线会出现不一样的Error,
是我电脑的问题吗@@??
希望有人能帮我指点迷津,我还不认识路径>"<~。
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 218.167.57.43
1F:推 picachuxyz:因为你的档案是在伺服器端..所以用伺服器根目录写法 03/12 14:23
2F:→ picachuxyz:比较不会出现一些奇怪的问题.. 03/12 14:24
3F:→ picachuxyz:$current_dir= 03/12 14:25
4F:→ picachuxyz:$_SERVER['DOCUMENT_ROOT'].'/pratice/images/'; 03/12 14:27
5F:推 dream1129:我用了!!可是还是出现一样的错误ㄟ!!我po给你看~ 03/12 14:42
6F:→ dream1129:Warning: readdir(): supplied argument is not a valid 03/12 14:43
7F:→ dream1129:Directory resource in C:\AppServ\www\practice\ 03/12 14:43
8F:→ dream1129:browsedir.php on line 16 03/12 14:45
9F:→ dream1129:Warning:closedir(): supplied argument is not a valid 03/12 14:46
10F:→ dream1129:Directory resource in C:\AppServ\www\practice\ 03/12 14:46
11F:→ dream1129:browsedir.php on line 21 03/12 14:47
12F:推 ahbi0302:你的网页本身就在practice里面阿? 03/13 09:17
13F:→ ahbi0302:直接opendir(images);就好了 03/13 09:19
14F:→ ahbi0302:网页最好不要用绝对路径,减少麻烦 03/13 09:21
15F:→ ahbi0302:移到空间上也不用再做修改 03/13 09:21
16F:推 ahbi0302:有没有这个? 03/13 09:25
17F:→ ahbi0302:opendir(): failed to open dir: No such file or 03/13 09:25
18F:→ ahbi0302: directory 03/13 09:26
19F:→ ahbi0302:应改会有这个吧? 03/13 09:26