如何通过PHP脚本之间的变量? [英] How to pass variables between php scripts?
本文介绍了如何通过PHP脚本之间的变量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有什么办法PHP脚本之间传递值和变量?
Is there any way to pass values and variables between php scripts?
在形式上,我试着codeA登录页面,当用户输入错误的输入首另一个脚本将检查输入,如果它是错误的,网站会返回到最后一个脚本页面,并显示警告,如这是错误输入。对于这个目标,我需要从脚本,我想传递值。
Formally, I tried to code a login page and when user enter wrong input first another script will check the input and if it is wrong, site returns to the last script page and show a warning like "It is wrong input". For this aim, I need to pass values from scripts I guess.
问候...:P
推荐答案
要通过GET传递信息
header('Location: otherScript.php?var1=val1&var2=val2');
会议
// first script
session_start();
$_SESSION['varName'] = 'varVal';
header('Location: second_script.php'); // go to other
// second script
session_start();
$myVar = $_SESSION['varName'];
发表:看看这
这篇关于如何通过PHP脚本之间的变量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文