【发布时间】:2014-04-13 04:08:31
【问题描述】:
我正在尝试通过使用传递一个数组
$variables=questions_file='.($questions_file).'&questions_id='.($questions_id).'&count_hindi='.$count_hindi;
echo '<Redirect method="GET">startCall.php?'.$variables.'</Redirect>';
questions_file 和 questions_id 都是数组
foreach($question_records as $record=>$question)
{
$questions_file[$i]=$question['file_name'].'_'.$question['concept_tested'];
$questions_id[$i]=$question['question_id'];
echo $questions_file[$i]. "\n";
$i++;
}
因此,当我回显数组时,它会完美显示。但是当我使用上面的代码将它传递给另一个文件时,我尝试打印数组元素,它打印为空白。我尝试使用序列化和反序列化,但它仍然不起作用
我现在想通过使用检索值
$questions_id=(array)($_REQUEST['questions_id']);
$questions_file=(array)($_REQUEST['questions_file']);
但是当我尝试访问成员时。
使用时:
$questions_file= urldecode(http_build_query($questions_file));
$questions_url= urldecode(http_build_query($questions_id));
$url = $server.'/startCall.php?call_id='.$call_id.'&phone='.$phone.'&questions_id='.$questions_id.'&questions_file='.$questions_file.'&student_id='.$student_id.'&story='
.$story.'&call_number='.$call_number.'&question_number=0&response=0&count_english=0&count_hindi=0';
我明白了
questions_file 0=q1_vocab&1=q3_comp&2=q5_crit&3=q7_gra
我想得到
questions_file[0]=q1_vocab&questions_file[1]=q3_comp&questions_file[2]=q5_crit&questions_file[3]=q7_gra
【问题讨论】:
-
您能否详细说明“不工作”...?
-
想知道是否有助于转义您的 $variables 字符串,以便正确传输 & 符号...
-
@RobP 如何转义变量,请检查我的更新回复