Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/293.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在php中通过url传递数组_Php - Fatal编程技术网

在php中通过url传递数组

在php中通过url传递数组,php,Php,我希望通过url传递一个数组。我查了一下。没有别的办法吗?下面是我的代码 $result=Users.LoggedInUsers(); header('Location: http://localhost/Campus/Users.php?id='.$result.''); 退房 您可以轻松地将其删除,然后取消序列化以将其恢复到阵列: $result=serialize(Users.LoggedInUsers()); header('Location: http://localhost/Ca

我希望通过url传递一个数组。我查了一下。没有别的办法吗?下面是我的代码

$result=Users.LoggedInUsers();
header('Location: http://localhost/Campus/Users.php?id='.$result.'');
退房

您可以轻松地将其删除,然后取消序列化以将其恢复到阵列:

$result=serialize(Users.LoggedInUsers());
header('Location: http://localhost/Campus/Users.php?id='.$result.'');

如果从URL取消序列化不受信任的输入,请确保验证数组的全部内容。它显示以下错误警告:标头不能包含多个标头,在Users上检测到新行。php i did$booksArr=$_GET['id']$结果=取消序列化(urldecode($booksArr));
$result=serialize(Users.LoggedInUsers());
header('Location: http://localhost/Campus/Users.php?id='.$result.'');