我是新手,需要帮助,使用 php 数组调用.我确实使用var_dump并显示这一点


I'm newbie and Need help, with php array call. I do use var_dump and show this

首先,我正在寻求任何专家对PHP数组调用的帮助。我尝试使用var_dump但仍然无法调用我的数据。我真的是一个初学者,需要很多帮助。感谢您之前阅读我下面的问题...

<?php var_dump($this->product->customfieldsSorted); ?>

我使用它并获取此数组列表...

array(1) {
["normal"]=>
array(1) {
  [0]=>
  object(stdClass)#222 (36) {
    ["virtuemart_custom_id"]=>
    string(2) "21"
    ["custom_parent_id"]=>
    string(1) "0"
    ["virtuemart_vendor_id"]=>
    string(1) "1"
    ["custom_jplugin_id"]=>
    string(1) "0"
    ["custom_element"]=>
    string(0) ""
    ["admin_only"]=>
    string(1) "0"
    ["custom_title"]=>
    string(5) "Slide"
    ["show_title"]=>
    string(1) "0"
    ["custom_tip"]=>
    string(0) ""
    ["custom_value"]=>
    string(0) ""
    ["custom_desc"]=>
    string(0) ""
    ["field_type"]=>
    string(1) "M"
    ["is_list"]=>
    string(1) "0"
    ["is_hidden"]=>
    string(1) "1"
    ["is_cart_attribute"]=>
    string(1) "0"
    ["is_input"]=>
    string(1) "0"
    ["layout_pos"]=>
    string(0) ""
    ["custom_params"]=>
    string(26) "width="1024"|height="400"|"
    ["shared"]=>
    string(1) "0"
    ["published"]=>
    string(1) "1"
    ["ordering"]=>
    string(1) "0"
    ["virtuemart_customfield_id"]=>
    string(3) "110"
    ["virtuemart_product_id"]=>
    string(2) "95"
    ["customfield_value"]=>
    string(2) "15"
    ["customfield_price"]=>
    NULL
    ["customfield_params"]=>
    string(25) "width="200"|height="200"|"
    ["fpublished"]=>
    string(1) "0"
    ["override"]=>
    string(1) "0"
    ["disabler"]=>
    string(1) "0"
    ["_varsToPushParamCustom"]=>
    array(2) {
      ["width"]=>
      array(2) {
        [0]=>
        string(3) "200"
        [1]=>
        string(6) "string"
      }
      ["height"]=>
      array(2) {
        [0]=>
        string(3) "200"
        [1]=>
        string(6) "string"
      }
    }
    ["_varsToPushParamCustomField"]=>
    array(2) {
      ["width"]=>
      array(2) {
        [0]=>
        string(3) "200"
        [1]=>
        string(6) "string"
      }
      ["height"]=>
      array(2) {
        [0]=>
        string(3) "200"
        [1]=>
        string(6) "string"
      }
    }
    ["_varsToPushParam"]=>
    array(2) {
      ["width"]=>
      array(2) {
        [0]=>
        string(3) "200"
        [1]=>
        string(6) "string"
      }
      ["height"]=>
      array(2) {
        [0]=>
        string(3) "200"
        [1]=>
        string(6) "string"
      }
    }
    ["width"]=>
    string(3) "200"
    ["height"]=>
    string(3) "200"
    ["_xParams"]=>
    string(18) "customfield_params"
    ["display"]=>
    string(101) "<img src="/angga/images/stories/virtuemart/product/resized/marinecap_200x200.jpg" alt="marinecap"  />"
  }
}

不,我想得到:

["display"]=>
string(101) "<img src="/angga/images/stories/virtuemart/product/resized/marinecap_200x200.jpg" alt="marinecap"  />"

使用这个:

<?php echo $this->product->customfieldsSorted->display;?>

一无所获。谁能帮忙?我不知道。完全没有。在:)之前谢谢

$this->product->customfieldsSorted是一个键"normal"的数组,可以得到对应的值:$this->product->customfieldsSorted['normal']

$this->product->customfieldsSorted['normal']是一个键0数组,得到它的值:$this->product->customfieldsSorted['normal'][0]

$this->product->customfieldsSorted['normal'][0]stdClass的对象,可以使用$this->product->customfieldsSorted['normal'][0]->display获取属性display的值。