将数组从一个页面传递到另一个页面php
问题描述:
如何在PHP中将数组值从一个页面传递到另一个页面,并在另一个页面中检索该数组的值。 我使用array_push函数来使用循环插入数组中的数据库的值,如下所示。将数组从一个页面传递到另一个页面php
array_push($file_names,$row['sVoiceFileName'])));
现在,我想将$ file_array变量传递给另一个页面。我尝试下面的代码来传递数组,但不工作。它只显示网址中的数组。
echo "<a href='download.php?voice=". $file_names."'> ". "Download All"."</a>";
是否有任何其他方式传递数组到另一个页面或使用post方法。我怎样才能检索另一个页面的价值。 在这里,我试图下载包含在数组中的所有文件作为zip。为此,我有功能
function zipFilesAndDownload($file_names,$archive_file_name,$file_path)
在另一页。我需要将$ file_names数组传递给该函数。
答
这是怎么回事?
echo "<a href='download.php?voice=". impode(';', $file_names)."'> ". "Download All"."</a>";
function zipFilesAndDownload($file_names,$archive_file_name,$file_path)
{
$file_names = explode(';', $file_names);
}
破灭/爆炸,你也可以通过json_encode/json_decode更换,序列化/反序列化,只是在你的愿望。
在这种情况下,你应该关心的发生;数组值中的符号。 – heximal 2012-04-17 08:43:40