找回密码
 免费注册

php表单提交数据的两种方式get和post区别

[复制链接]
发表于 2022-11-24 15:47:10 | 显示全部楼层 |阅读模式
php表单提交数据的两种方式get和post区别

get很灵活,只要有页面的跳转就可以传递参数
post不灵活,post提交需要有表单的参与
  1. 1、 html跳转
  2.    <a href="index.php?name=tom&age=20">跳转</a>

  3. 2、JS跳转
  4. <script type="text/javascript">
  5.         location.href='index.php?name=tom&age=20';
  6.         location.assign('index.php?name=tom&age=20');
  7.         location.replace('index.php?name=tom&age=20');
  8. </script>

  9. 3、PHP跳转
  10. header('location:index.php?name=tom&age=22')
复制代码
小结:
GET
POST
外观上在地址上看到传递的参数和值地址栏上看不到数据
提交数据大小提交少量数据,不同的浏览器最大值不一样,IE是255个字符提交大量数据,可以通过更改php.ini配置文件来设置post提交数据的最大值
安全性
提交原理提交的数据和数据之间在独立的将提交的数据变成XML格式提交
灵活性很灵活,只要有页面的跳转就可以get传递数据不灵活

QQ|Archiver|小黑屋|网站地图|深圳市金黑网络技术有限公司 ( 粤ICP备2021124338号|粤公网安备 44030702003689号 )

GMT+8, 2026-8-8 17:12 , Processed in 0.061604 second(s), 24 queries .

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表