从本地主机到文件夹的路径 [英] Path to folder from localhost

查看:107
本文介绍了从本地主机到文件夹的路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的项目中,我正在使用EasyPHP,而我想访问的目录是 -> www/myP/profile_icon:

In my project, I am using EasyPHP and the directory I wanted to access is -> www/myP/profile_icon:

我正在尝试使用以下代码访问profile_icon文件夹:

I am trying to access profile_icon folder by using the code:

   $dir = "myP/profile_icon";
   $handle = opendir($dir."/");

但是,我收到警告:

警告:opendir(myP/profile_icon/,myP/profile_icon/):系统 找不到指定的路径. (代码:3)在C:\ Program中 Files \ EasyPHP-12.1 \ www \ myP \ functions.php

Warning: opendir(myP/profile_icon/,myP/profile_icon/): The system cannot find the path specified. (code: 3) in C:\Program Files\EasyPHP-12.1\www\myP\functions.php

推荐答案

我认为这是您想要的:

$base_dir  = 'C:\Program Files\EasyPHP-12.1\www\myP';
$icon_dir  = '\profile_icon';
$handle = opendir($base_dir.$icon_dir.'\');

在Windows计算机上使用PHP时,您不必注意斜杠的使用. Linux让我们仅使用正斜杠/,但是在Windows上,正斜杠/和反斜杠\都用作路径分隔符.

As you're using PHP on Windows machine you mustn't pay attention to the use of the slashes. Linux let's us only use forward-slash /, however on Windows, both forward-slash / and back-slash \ are used as path separator character.

这篇关于从本地主机到文件夹的路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆