0

我正在启动一个社交网络,它使用 Windows 记事本文件来保存此人的“提要”。但是,在我的帐户保存页面上,我的 PHP 似乎不起作用。它不会保存文件。对不起,如果我是“菜鸟”

这是我的代码:

<?php
$u = $_POST['user'];
$n = $_POST['name'];
$p = $_POST['password'];
$e = $_POST['email'];
$f = $_POST['email'] . ".txt";

$con=mysqli_connect("localhost","root","password","account");
mysqli_query($con,"INSERT INTO socialnet (name,user,password,file,email) VALUES ($n,$u,$p,$f,$e)");

$o = fopen('/' . $f,'c');

fwrite($o,"Hi. I just joined. Wait a few until I get my feed going");
fclose($o);
echo "<b>Your account has been saved. Now, please click the link at the top of the page to go back and log in.</b>";

?>

请不要严厉的回应。

4

1 回答 1

1

不允许将文件写入服务器的根目录 ( /)。选择或创建一个您确实具有写入权限的目录,然后使用它。

于 2013-10-30T21:35:37.920 回答