Pass array from one page to another

后端 未结 4 1578
时光说笑
时光说笑 2021-01-13 04:55

I have an array containing some values, say

arr[\'one\'] = \"one value here\";
arr[\'two\'] = \"second value here\";
arr[\'three\'] = \"third value here\";
         


        
4条回答
  •  無奈伤痛
    2021-01-13 05:32

    home.php file

    session_start();
    if(!empty($arr)){
        $_SESSION['value'] = $arr;
         redirect_to("../detail.php");
    }
    

    detail.php

    session_start();                    
    if(isset($_SESSION['value'])){                           
        foreach ($_SESSION['value'] as $arr) {
            echo $arr . "
    "; unset($_SESSION['value']); } }

提交回复
热议问题