将变量传递给另一个文件
Pass Variable To Another file
我有两个文件(A.html,B.php)。 A.html 有一些按钮。单击按钮时,我想将带有按钮 ID 的变量传递给 B.php。我该怎么做?
这 2 个文件应该在同一位置并且 php 安装在您的服务器中
A.html
...
<a href="B.php?data1=1654&data2=string">Button</a>
...
B.php
<?php
echo $_GET['data1']; // output "1654"
echo $_GET['data2']; // output "string"
我有两个文件(A.html,B.php)。 A.html 有一些按钮。单击按钮时,我想将带有按钮 ID 的变量传递给 B.php。我该怎么做?
这 2 个文件应该在同一位置并且 php 安装在您的服务器中
A.html
...
<a href="B.php?data1=1654&data2=string">Button</a>
...
B.php
<?php
echo $_GET['data1']; // output "1654"
echo $_GET['data2']; // output "string"