简体   繁体   English

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

[英]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&parameter2=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.

相关问题 如何从php中的另一个URL获取一些数据? - How can I get some data from another url in php? PHP如何将值从一个数组传递到另一个数组? - PHP How can I pass values from one array to another? 如何将GET值传递给php中的另一个URL? 获取价值转发 - How can you pass GET values to another url in php? GET value forwarding 如何传递 PHP GET URL 变量以使用 Javascript 打开窗口? - How can I pass PHP GET URL variables to open a window with Javascript? 如何在Codeigniter中将某些值从一个视图传递到另一个视图? - How can I pass some values from one view to another view in codeigniter? 我如何从另一个PHP文件获取数据库详细信息? - how can i get the database details from another php file? 如何从另一个PHP文件获取输入值? - How can I get the input value, from another PHP file? 如何使用PHP将具有多个值的对象作为参数传递给url - How can I pass an object with multiple values as parameters in an url with PHP 如何包含一个php文件并在另一个php文件中获取函数值? - How can i include a php file and get the function values in another php file? 如何使用jquery从.php文件中提取一些php并在另一页上运行它? - How can I use jquery to pull some php from a .php file and run it on another page?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM