0
데이터베이스에 일련 필드가 있습니다. 나는이 필드의 내용을 가져올 수 있지만 그들을 unserialize 그러나 나는 특정 값을 얻는 방법을 모르겠습니다. 나는 궁극적으로 데이터로부터 각 아이템과 값의 foreach가 필요하다. 아래의 예에서 직렬화되지 않은 데이터에서 값 가져 오기
나는 다음과 같은 얻을 수 있어야합니다 :메인 이미지 교체 : BGL_Burhill_People_AndyHiseman_300dpi_Super-크기-14.JPG 무료 : 경화제 텍스트 견적 코드 : 코드 텍스트
foreach 내에서 변수를 하나의 변수로, 값을 다른 변수로 사용해야합니다. 이 레이블과 값은 가변적이므로이 데이터를 해당 레이블로 수동으로 가져올 수 없습니다.
array (
0 =>
array (
'mode' => 'builder',
'cssclass' => '',
'hidelabelinorder' => '',
'hidevalueinorder' => '',
'element' =>
array (
'type' => 'radio',
'rules_type' =>
array (
'Reprint_0' =>
array (
0 => '',
),
'Edit Artwork_1' =>
array (
0 => '',
),
),
'_' =>
array (
'price_type' => '',
),
),
'name' => '',
'value' => 'Edit Artwork',
'price' => '',
'section' => '58073632e582b5.35893028',
'section_label' => '',
'percentcurrenttotal' => 0,
'currencies' =>
array (
),
'price_per_currency' =>
array (
'GBP' => '',
),
'quantity' => 1,
'multiple' => '1',
'key' => 'Edit Artwork_1',
'use_images' => '',
'changes_product_image' => '',
'imagesp' => '',
'images' => '',
),
1 =>
array (
'mode' => 'builder',
'cssclass' => '',
'hidelabelinorder' => '',
'hidevalueinorder' => '',
'element' =>
array (
'type' => 'radio',
'rules_type' =>
array (
'BGL_Burhill_People_AndyHiseman_300dpi_Super-Size-14.JPG_0' =>
array (
0 => '',
),
'BGL_Burhill_People_AndyHiseman_300dpi_Super-Size-21.JPG_1' =>
array (
0 => '',
),
'BGL_Burhill_People_AndyHiseman_300dpi_Super-Size-77.JPG_2' =>
array (
0 => '',
),
),
'_' =>
array (
'price_type' => '',
),
),
'name' => 'Main Image Replacement',
'value' => 'BGL_Burhill_People_AndyHiseman_300dpi_Super-Size-14.JPG',
'price' => '',
'section' => '58073632e582d2.46631826',
'section_label' => 'Main Image Replacement',
'percentcurrenttotal' => 0,
'currencies' =>
array (
),
'price_per_currency' =>
array (
'GBP' => '',
),
'quantity' => 1,
'multiple' => '1',
'key' => 'BGL_Burhill_People_AndyHiseman_300dpi_Super-Size-14.JPG_0',
'use_images' => 'images',
'changes_product_image' => '',
'imagesp' => '',
'images' => 'http://burhill.immaculate.co.uk/wp-content/uploads/2016/10/BGL_Burhill_People_AndyHiseman_300dpi_Super-Size-14-150x150.jpg',
),
2 =>
array (
'mode' => 'builder',
'cssclass' => 'col-6',
'hidelabelinorder' => '',
'hidevalueinorder' => '',
'element' =>
array (
'type' => 'textfield',
'rules_type' =>
array (
0 =>
array (
0 => '',
),
),
'_' =>
array (
'price_type' => '',
),
),
'name' => 'Complimentary',
'value' => 'Comp Text',
'price' => '',
'section' => '58073632e582f4.32183997',
'section_label' => 'Complimentary',
'percentcurrenttotal' => 0,
'currencies' =>
array (
),
'price_per_currency' =>
array (
),
'quantity' => 1,
),
3 =>
array (
'mode' => 'builder',
'cssclass' => 'col-6',
'hidelabelinorder' => '',
'hidevalueinorder' => '',
'element' =>
array (
'type' => 'textfield',
'rules_type' =>
array (
0 =>
array (
0 => '',
),
),
'_' =>
array (
'price_type' => '',
),
),
'name' => 'Quote Code',
'value' => 'Code Text',
'price' => '',
'section' => '58073632e58317.46363272',
'section_label' => 'Quote Code',
'percentcurrenttotal' => 0,
'currencies' =>
array (
),
'price_per_currency' =>
array (
),
'quantity' => 1,
),
)
당신이 무엇을 요구하고 있는지 분명하지 않습니다. 그리고 여러분의 배열은 지저분 해 보이며 체계적인 배열이없는 것처럼 보입니다. 읽을 수있게 만드십시오. –
StackOverflow에 오신 것을 환영합니다. 유감 스럽지만 배열에 가변 데이터가 포함되어 있으므로 원하는 데이터를 찾을 때까지 모든 데이터를 반복하는 것 외에 다른 방법은 없습니다. 어떤 코드를 게시하지 않았으므로 어떤 것을 시도했는지 또는 어떤 문제 또는 오류가 있는지 알기가 어렵습니다. 가능한 한 구체적이어야 더 나은 답변으로 이어질 것입니다. –