小编Man*_*dez的帖子

多维数组到对象,具体方式

我知道这类问题已被问到很多,但我还没有发现如何做到这一点就像我希望的那样.

所以,基本上我有这个数组.

array(7) {
  ["site"]=>
  array(5) {
    ["production"]=>
    bool(false)
    ["url"]=>
    string(29) "http://localhost/"
    ["name"]=>
    string(6) "Sitename"
    ["title"]=>
    string(7) ": Index"
    ["pagedata"]=>
    array(1) {
      ["default"]=>
      string(5) "Index"
    }
  }
  ["DB"]=>
  array(5) {
    ["host"]=>
    string(9) "localhost"
    ["user"]=>
    string(4) "root"
    ["pass"]=>
    string(4) "secret"
    ["database"]=>
    string(12) "database"
    ["engine"]=>
    string(7) "eMySQLi"
  }
  ["cache"]=>
  array(2) {
    ["file"]=>
    array(1) {
      ["time"]=>
      int(500)
    }
    ["memcache"]=>
    array(2) {
      ["my_first_vps_ip"]=>
      string(17) "my_first_vps_port"
      ["my_second_vps_ip"]=>
      string(18) "my_second_vps_port"
    }
  }
  ["skin"]=>
  array(2) {
    ["name"]=>
    string(9) "thehabbos"
    ["mobile"]=>
    array(2) {
      ["enabled"]=>
      bool(true)
      ["name"]=>
      string(16) "mobile_thehabbos" …
Run Code Online (Sandbox Code Playgroud)

php arrays object multidimensional-array

4
推荐指数
2
解决办法
3103
查看次数

标签 统计

arrays ×1

multidimensional-array ×1

object ×1

php ×1