Linux 我想显示下面显示的数组中的值,如何在 PHP 中编写语法来获取结果显示?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3677000/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-03 23:07:40  来源:igfitidea点击:

i want to display the value from the array displayed below, how to write a syntax in PHP to get the result display?

phparraysobject

提问by OM The Eternity

I want to display the value from the array displayed below, how to write a syntax in PHP to get the result display?

我想显示下面显示的数组中的值,如何在PHP中编写语法来获取结果显示?

This is how I got the below array

这就是我得到以下数组的方式

Now my requirement is to get the value of "osCsid", please help me out...

现在我的要求是获取“osCsid”的值,请帮帮我...

echo "<pre>";
var_dump($_SESSION["navigation"]);



object(navigationHistory)#2 (2) {
      ["path"]=>
      array(4) {
        [0]=>
        array(4) {
          ["page"]=>
          string(10) "logoff.php"
          ["mode"]=>
          string(6) "NONSSL"
          ["get"]=>
          array(0) {
          }
          ["post"]=>
          array(0) {
          }
        }
        [1]=>
        array(4) {
          ["page"]=>
          string(9) "index.php"
          ["mode"]=>
          string(6) "NONSSL"
          ["get"]=>
          array(1) {
            ["osCsid"]=>
            string(26) "m3gvb90q0c36p7chtiq6pksrs6"
          }
          ["post"]=>
          array(0) {
          }
        }
        [2]=>
        array(4) {
          ["page"]=>
          string(11) "account.php"
          ["mode"]=>
          string(6) "NONSSL"
          ["get"]=>
          array(1) {
            ["osCsid"]=>
            string(26) "m3gvb90q0c36p7chtiq6pksrs6"
          }
          ["post"]=>
          array(0) {
          }
        }
        [3]=>
        array(4) {
          ["page"]=>
          string(24) "account_history_info.php"
          ["mode"]=>
          string(6) "NONSSL"
          ["get"]=>
          array(2) {
            ["order_id"]=>
            string(3) "491"
            ["osCsid"]=>
            string(26) "m3gvb90q0c36p7chtiq6pksrs6"
          }
          ["post"]=>
          array(0) {
          }
        }
      }
      ["snapshot"]=>
      array(0) {
      }
    }

采纳答案by Tristan

$osCsid = array()

foreach ($_SESSION["navigation"]["path"] as $value)
{
   $osCsid[] = $value["get"]["osCsid"];
}

or something similar

或类似的东西