我试图通过以下方式从一个PHP文件发送数组:
$question_records=findQuestions($db,$student_id,$story_id,$call_number);
echo count($question_records).'<br/>';
$i=0;
foreach($question_records as $record=>$question)
{
$questions_file[$i]=$question['file_name'].'_'.$question['concept_tested'];
$questions_id[$i]=$question['question_id'];
echo "Array Elements:</br>";
echo $questions_file[$i]. "</br>";
$i++;
}
输出:
Array Elements:
q1_comp
q2_vocab
q3_cri
功能makeCall
makeCall($call_id,$phone,$questions_file,$questions_id,$student_id,$story,$call_number);
function makeCall($call_id,$phone,$questions_file,$questions_id,$student_id,$story,$call_number){
$questions_file= urldecode(http_build_query($questions_file));
echo "ECHO NEW STMT questions_file \n";
echo $questions_file;
$questions_id= urldecode(http_build_query($questions_id));
echo "ECHO NEW STMT questions_id \n";
echo $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';
echo '<Redirect method="GET">startCall.php?'.$url.'</Redirect>';
startCall.php
$questions_id=array('questions_id' => $_REQUEST['questions_id']);
$questions_file=array('questions_file' =>$_REQUEST['questions_file']);
echo "FOR QUESTIONS ID in STARTCALL.PHP";
echo 'output1'.$questions_file.'</br>';
echo 'output2'.$questions_file[0];
我得到的输出是
output1Array
output2
但是,我想要做的是访问数组元素(q1_comp,q2_vocab,q3_cri)。有谁知道它为什么不起作用。我已经尝试了所有的东西,并且真的需要这个尽快工作。谢谢!
答案 0 :(得分:0)
在startCall.php中尝试以下
echo 'output1'.print_r($questions_file,true).'</br>';