如何制作新的文件夹php变量

时间:2015-12-14 17:38:57

标签: php

我在root/(http docs)内置新文件夹example/

example/个文件夹中添加cache.php页面

来自cache.php的PHP代码:

/* Cache file to either load or create */
  $cachefile = $cachedir . md5($page) . 'cache/' . $cacheext;
  $cachefile_created = ((@file_exists($cachefile)) and ($ignore_page === false)) ? @filemtime($cachefile) : 0;
  @clearstatcache();

我有一个问题:

$cachefile = $cachedir . md5($page) . 'cache/' . $cacheext;

变量/./使html文件位于example/

之外

example/新文件夹/cache内。

谁是绝对的道路?例如:

/cache/./cache/./cache

2 个答案:

答案 0 :(得分:0)

./cache is a relative path

for example : if you are in the /dir directory, and your variable holds as $var = './path/to' then it means /dir/path/to

any directory which starts with a / it is absolute path. for example if you are in /dir directory and your variable holds as $var = '/path/to' then it means /path/to it is not related with /dir directory anymore.

./ this stands for the current directory ./ == ./././././ /./ this is root directory / first slash is the root directory and ./ is the relative path to root directory, you are saying root directory's current directory which means the root directory.

答案 1 :(得分:0)

problem this is folder example/cache.php genarete html file outside example/

httpdocs/example/

i have make new folder path httpdocs/example/cache/

problem line:

$cachefile = $cachedir . md5($page) . 'cache/' . $cacheext; Variable /./ make html file outside example/

Inside example/ new folder /cache.

Who is absolute path? Example:

/cache/ or ./cache or /./cache?