& seat = S1& seat = S2& seat = S3如何从url获取这些值并存储在数组中 通过使用PHP代码 $ seat [] = 8;
$adult1 = $_GET['adult1'];
$child1 = $_GET['child1'];
$coach =$_GET['ch'];
echo $seat= $_GET['seat'];
答案 0 :(得分:1)
像Rishi提到的那样,你在旧钥匙上面。 您必须使用括号在$ _GET数组中存储多个值。
例如:example.com?seat [] = S1& seat [] = S2& seat [] = S3
$seatArray = $_GET['seat'];
这些值存储在$ seatArray中,这是一个常见的数组:
foreach($seatArray as $seat)
{
echo $seat . '<br/>;
}
输出将是:
S1
S2
S3
答案 1 :(得分:0)
我说在网址中使用座位[] = S1&amp; seat [] = S2&amp; seat [] = S3更安全