[英]How can I open another url from a php file and pass some values with the get method?
I have a php script that checks if the user typed the right password for the right username. 我有一个php脚本,用于检查用户是否为正确的用户名输入了正确的密码。
If its right I want to open another php page and pass some values with the get method. 如果正确的话,我想打开另一个PHP页面并使用get方法传递一些值。 How do I do this? 我该怎么做呢? Im pretty new to php. 我对php很陌生。
You can redirect to that page if this is your case: 在这种情况下,您可以重定向到该页面:
if(condition){
header("Location: yourfile.php?parameter1=value1¶meter2=value2");
exit();
}
Note: header should be called before any output, its recommended to call it at top of the page before printing anything. 注意:标头应在任何输出之前调用,建议在打印任何内容之前在页面顶部调用标头。
Or use cURL to send the GET request. 或使用cURL发送GET请求。
Don't use GET
to send password! 不要使用GET
发送密码!
Instead try to use cURL
lib and send it via POST
. 而是尝试使用cURL
lib并通过POST
发送。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.