什么是PHP中的查询字符串? [英] what's query string in php?

查看:62
本文介绍了什么是PHP中的查询字符串?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

hi
i想知道PHP中的查询字符串

是php中重要的查询字符串吗?

hi i want know about query string in PHP
is it important query string in php?

推荐答案

什么是查询字符串?



想象一下,您有一个URL:

What is a query string?


Imagine you have a URL:
http://www.mywebsite.com/page.php?id=5&name=php



然后查询字符串是:


Then the query string is:

?id=5&name=php



在这种情况下,查询由两部分组成:一个键 id with值 5 ,以及值名称,值 php



您可以使用以下代码访问查询字符串键的值:


In this case, the query consists of two parts: a key id with value 5, and a key name with value php.

You can access the value of the query string keys using this code:


id =
id =


_GET [' id'];
_GET['id'];



以上代码获取 id的值,在这种情况下 5

重要吗?



是的,因为您可以使用它将数据从一个页面传递到另一个页面。但这并不是传递数据的唯一可能性。如果您的数据包含很多字符,请使用 POST [ ^ ]而不是查询字符串。



如果您想传递密码,使用GET(查询字符串)传递密码!你需要通过POST传递它,SSL是必须的! SSL在Web浏览器和Web服务器之间创建加密连接。没有SSL,通过POST传递密码与通过GET传递密码相同,因为POST数据也是未加密的。但是使用SSL,GET数据仍然是未加密的(但POST数据已加密),这就是你需要POST密码的原因。


The above code gets the value of id, which is 5 in this case.

Is it important?


Yes, it is, because you can use it to pass data from one page to another. But it's not the only possibility to pass data. If your data contains much characters, use POST[^] instead of a query string.

If you want to pass a password, don't pass it using GET (query strings)! You need to pass it through POST, and SSL is a must! SSL creates an encrypted connection between a web browser and a web server. Without SSL, passing passwords through POST is the same as through GET, because the POST data is also unencrypted. But with SSL, GET data is still unencrypted (but POST data is encryped), that's why you need POST for passwords.


这篇关于什么是PHP中的查询字符串?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆