我的wamp服务是正常运行的,我也配置好了php环境变量,单独的php文件用浏览器编译运行,但是不知道为什么html表单提交到php就没有数据了。
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<form action="02.php" method="post">
标题:
<input type="text" name="title"><br>
内容:
<textarea name="content" id="" cols="30" rows="10"></textarea><br>
<input type="submit" value="提交">
</form>
</body>
</html>
<?php
//打开一个文件
$fh = fopen('./msg.txt', 'a');
//
//写内容
fwrite($fh,$_POST['title'] . ',' . $_POST['content'] . "\n");
//关闭资源
fclose($fh);
echo "ok";
?>
http://biancheng.dnbcw.info/php/96153.html
我在本机上测试过了 你的代码没问题 应该是你的www目录在c盘 php没有权限创建txt目录 所以写入失败 你看下是不是
而且我wamp不装在c盘的话,又启动不了。。。
访问php文件不应该使用绝对路径 应该是类似locahost的方式
确定走服务器执行的??