Split below array and get values like
在数组下面拆分并得到像这样的值
Category
Brand
Subcategory
Packaging
Packing
分类品牌子类别包装包装
Array
(
[0] => Array
(
[0] => stdClass Object
(
[col_ref_name] => Category
)
)
[1] => Array
(
[0] => stdClass Object
(
[col_ref_name] => Brand
)
)
[2] => Array
(
[0] => stdClass Object
(
[col_ref_name] => Subcategory
)
)
[3] => Array
(
[0] => stdClass Object
(
[col_ref_name] => Packaging
)
)
[4] => Array
(
[0] => stdClass Object
(
[col_ref_name] => Packing
)
)
)
1 个解决方案
#1
1
use a code like below :
使用如下代码:
foreach($yourArray as $array)
{
echo $array[0]-> col_ref_name . "<br>";
}
Your array has objects in the sub array and col_ref_name is the property of that objects, so i used a foreach loop to go through all elements of the array (which are objects) and then access the data in the col_ref_name.
您的数组在子数组中有对象,col_ref_name是该对象的属性,因此我使用foreach循环遍历数组的所有元素(对象),然后访问col_ref_name中的数据。
I hope this will help.
我希望这将有所帮助。
#1
1
use a code like below :
使用如下代码:
foreach($yourArray as $array)
{
echo $array[0]-> col_ref_name . "<br>";
}
Your array has objects in the sub array and col_ref_name is the property of that objects, so i used a foreach loop to go through all elements of the array (which are objects) and then access the data in the col_ref_name.
您的数组在子数组中有对象,col_ref_name是该对象的属性,因此我使用foreach循环遍历数组的所有元素(对象),然后访问col_ref_name中的数据。
I hope this will help.
我希望这将有所帮助。