html表单最基本的形式是form中设置action属性(数据提交路径)method表示提交数据的类型(get和post)。使用这种方式提交表单,表单元素必须设置name属性。
表单中设置这两个属性就可以获得表单的值了。
例如:
<form action="index.php" method="post"><input type="text" name="user" />
<input type="submit" value="提交" />
</form> <?php
//post接收表单传过来的值
$user=$_POST['user']
echo $user
?>
PHP写入HTML文件可以使用file_put_contents,例如:file_put_contents('a.html', "<html>
<body>hello</body>
</html>")
PHP访问HTML文件可以使用readfile、file等,例如:
readfile('a.html')
html表单最基本的形式是form中设置action属性(数据提交路径)method表示提交数据的类型(get和post)。使用这种方式提交表单,表单元素必须设置name属性。表单中设置这两个属性就可以获得表单的值了。
例如:
<form
action="index.php"
method="post">
<input
type="text"
name="user"
/>
<input
type="submit"
value="提交"
/>
</form><?php
//post接收表单传过来的值
$user=$_POST['user']
echo
$user
?>
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)