php

时间:2019-05-21 06:40:34

标签: php session

我已经在PHP中创建了一个会话数组,并给出了条件:如果已经创建了会话,则推入该数组;如果未创建,则创建会话并向其中推入行,但是当我检查条件时,我收到的会话不是创建

<?php
  session_start();
  $quiz_session = Array ( [0] => Array ( [ID] => 41 [Question] => abc ) );
  if (isset($_SESSION["quiz_question"])) {
     $_SESSION['quiz_question'] = array();
     $quiz_question = $_SESSION['quiz_question'];
     array_push($_SESSION['quiz_question'], array('Question' => $quiz_session[0]['Question'],'selected' => $Answer));
  }else{
     array_push($_SESSION['quiz_question'], array('Question' => 
     $quiz_session[0]['Question'],'selected' => $Answer));
   }
   print_r($_SESSION['quiz_question']);
?>

有人可以帮我吗

0 个答案:

没有答案