如何从 php 文件中打开另一个 url 并使用 get 方法传递一些值


How can I open another url from a php file and pass some values with the get method?

我有一个php脚本,可以检查用户是否为正确的用户名输入了正确的密码。

如果它是正确的,我想打开另一个 php 页面并使用 get 方法传递一些值。我该怎么做?我对 php 很陌生。

如果是这种情况,您可以重定向到该页面:

if(condition){
 header("Location: yourfile.php?parameter1=value1&parameter2=value2");
 exit();
}

注意:标头应在任何输出之前调用,建议在打印任何内容之前在页面顶部调用它。

或者使用 cURL 发送 GET 请求。

不要使用GET发送密码!

相反,请尝试使用cURL库并通过POST发送。