一、php和表单
1.POST方法手动发送数据:
二者部分区别:
GET:
1.将信息聚集起来作为URL一部分传送
立即学习“PHP免费学习笔记(深入)”;
2.传送数量有限
3.公开传送,诸如密码信息会暴露
4.创建的表单可以添加为书签。
POST:
1.传递的信息用户看不到
用法示例:
html文件:ws.html
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>test</title> <body> </body> </html>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>test</title> </head> <body> 
<?php
ini_set('display_errors', 1);
error_reporting(E_ALL|E_STRICT);
http://blog.csdn.net/u014761420/article/details/<strong><span style="color:#ff0000;">$title=$_POST['title'];
$name =$_POST['name'];</span></strong>
print "<p> hello <span style="color:#ff0000;">$title $name</span>";
?>
</body>
</html> 结果:hello Mr myname
2.GET传送数据
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>test</title> <body> <ul> <li><span style="color:#ff0000;">"handle.php?name=Charles</span></strong>">Charles</li> </ul> </body> </html>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>test</title> </head> <body> 
<?php
ini_set('display_errors', 1);
error_reporting(E_ALL|E_STRICT);
http://blog.csdn.net/u014761420/article/details/<strong><span style="color:#ff0000;">$name=$_GET['name'];
print "<p> hello $name";</span></strong>
?></body> </html>
二、相关函数学习
1.格式化数值:
round(要格式化的数字 , 保留小数点位数);
eg:$test=5.555555555; round(test, 2); // 5.55
number_format(数字, 小数点位数, 代替小数点的符号, 千位分隔符)
eg:number_format("10000000", 2 ,"," ,".");// 10.000.000,00
2.随机函数rand()
eg:rand(0, 100);//产生0-100 随机一个数
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号