【发布时间】:2014-06-15 18:40:39
【问题描述】:
这是我的代码
include 'connection.php';
setcookie('username',$name,time()+86400,"/");
echo $_COOKIE['username'];
$my_file = '/../../users/'.$name."/index.php";
$handle = fopen($my_file, 'w') or die('Cannot open file: '.$my_file);
当代码运行时,我希望它创建一个目录为/../../users/[username] 的文件,其中[username] 存储在$name 变量中。当我运行我的代码时,它只会给我一个糟糕的错误,并且在上面的第 6 行之后它不会运行任何代码。
它不会创建文件,错误是......
警告:fopen(/../../users/codemaster7/index.php) [function.fopen]:无法打开流:/nfs/c02/h10/mnt/45563/ 中没有这样的文件或目录domain/pizzascripters.com/html/projects/nik/Champion/register/index.php 在第 107 行 无法打开文件:/../../users/codemaster7/index.php
有没有人知道发生了什么以及如何解决它?
【问题讨论】:
标签: php file cookies directory fopen