Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/json/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何访问';Laravel'中的Json数据;_Php_Json_Laravel 5_Eloquent - Fatal编程技术网

Php 如何访问';Laravel'中的Json数据;

Php 如何访问';Laravel'中的Json数据;,php,json,laravel-5,eloquent,Php,Json,Laravel 5,Eloquent,我正在将json格式的服务器响应发送到我的laravel控制器。在我的控制器中,解码json数据并传递到我的视图。在laravel blade中,我无法访问数据 当我打印总解码结果时,它是如下所示 我试图通过$result->shipping\u address,$result['shipping\u address']访问此文件。但没有一个成功 JSON结果如下所示 [ {"data": { "entity_id":"77", "state":"ne

我正在将json格式的服务器响应发送到我的laravel控制器。在我的控制器中,解码json数据并传递到我的视图。在laravel blade中,我无法访问数据

当我打印总解码结果时,它是如下所示

我试图通过
$result->shipping\u address,$result['shipping\u address']
访问此文件。但没有一个成功

JSON结果如下所示

[
    {"data":
       {  "entity_id":"77",
          "state":"new",
          "status":"pending",
          "coupon_code":null,
          "protect_code":"ab0fc2890c4c9cc93d7d4586e5dcd8ff",
          "shipping_description":"Flat Rate - Fixed",
          "is_virtual":"0",
          "store_id":"1",
          "customer_id":"2",
          "base_discount_amount":"0.0000",
          "base_discount_canceled":null,
          "base_discount_invoiced":null,
          "base_discount_refunded":null,
          "base_grand_total":"2146.2300",
          "base_shipping_amount":"5.0000",
          "base_shipping_canceled":null,
          "base_shipping_invoiced":null,
          "base_shipping_refunded":null,
          "base_shipping_tax_amount":"0.0000",
          "base_shipping_tax_refunded":null,
          "base_subtotal":"1846.6800",
          "base_subtotal_canceled":null,
          "base_subtotal_invoiced":null,
          "base_subtotal_refunded":null,
          "base_tax_amount":"294.5500",
          "base_tax_canceled":null,
          "base_tax_invoiced":null,
          "base_tax_refunded":null,
          "base_to_global_rate":"1.0000",
          "base_to_order_rate":"1.0000",
          "base_total_canceled":null,
          "base_total_invoiced":null,
          "base_total_invoiced_cost":null,
          "base_total_offline_refunded":null,
          "base_total_online_refunded":null,
          "base_total_paid":null,
          "base_total_qty_ordered":null,
          "base_total_refunded":null,
          "discount_amount":"0.0000",
          "discount_canceled":null,
          "discount_invoiced":null,
          "discount_refunded":null,
          "grand_total":"2146.2300",
          "shipping_amount":"5.0000",
          "shipping_canceled":null,
          "shipping_invoiced":null,
          "shipping_refunded":null,
          "shipping_tax_amount":"0.0000",
          "shipping_tax_refunded":null,
          "store_to_base_rate":"0.0000",
          "store_to_order_rate":"0.0000",
          "subtotal":"1846.6800",
          "subtotal_canceled":null,
          "subtotal_invoiced":null,
          "subtotal_refunded":null,
          "tax_amount":"294.5500",
          "tax_canceled":null,
          "tax_invoiced":null,
          "tax_refunded":null,
          "total_canceled":null,
          "total_invoiced":null,
          "total_offline_refunded":null,
          "total_online_refunded":null,
          "total_paid":null,
          "total_qty_ordered":"1.0000",
          "total_refunded":null,
          "can_ship_partially":null,
          "can_ship_partially_item":null,
          "customer_is_guest":"0",
          "customer_note_notify":"1",
          "billing_address_id":"76",
          "customer_group_id":"1",
          "edit_increment":null,
          "email_sent":null,
          "send_email":"1",
          "forced_shipment_with_invoice":null,
          "payment_auth_expiration":null,
          "quote_address_id":null,
          "quote_id":"72",
          "shipping_address_id":"75",
          "adjustment_negative":null,
          "adjustment_positive":null,
          "base_adjustment_negative":null,
          "base_adjustment_positive":null,
          "base_shipping_discount_amount":"0.0000",
          "base_subtotal_incl_tax":"2141.2300",
          "base_total_due":"2146.2300",
          "payment_authorization_amount":null,
          "shipping_discount_amount":"0.0000",
          "subtotal_incl_tax":"2141.2300",
          "total_due":"2146.2300",
          "weight":"0.0000",
          "customer_dob":null,
          "increment_id":"000000157",
          "applied_rule_ids":null,
          "base_currency_code":"INR",
          "customer_email":"test@gmail.com",
          "customer_firstname":"ridha",
          "customer_lastname":"Gatto",
          "customer_middlename":null,
          "customer_prefix":null,
          "customer_suffix":null,
          "customer_taxvat":null,
          "discount_description":null,
          "ext_customer_id":null,
          "ext_order_id":null,
          "global_currency_code":"INR",
          "hold_before_state":null,
          "hold_before_status":null,
          "order_currency_code":"INR",
          "original_increment_id":null,
          "relation_child_id":null,
          "relation_child_real_id":null,
          "relation_parent_id":null,
          "relation_parent_real_id":null,
          "remote_ip":"193.33.131.226",
          "shipping_method":"flatrate_flatrate",
          "store_currency_code":"INR",
          "store_name":"Main Website\nMain Website Store\n",
          "x_forwarded_for":null,
          "customer_note":null,
          "created_at":"2018-11-28 06:01:59",
          "updated_at":"2018-11-28 06:02:09",
          "total_item_count":"1",
          "customer_gender":"0",
          "discount_tax_compensation_amount":"0.0000",
          "base_discount_tax_compensation_amount":"0.0000",
          "shipping_discount_tax_compensation_amount":"0.0000",
          "base_shipping_discount_tax_compensation_amnt":"0.0000",
          "discount_tax_compensation_invoiced":null,
          "base_discount_tax_compensation_invoiced":null,
          "discount_tax_compensation_refunded":null,
          "base_discount_tax_compensation_refunded":null,
          "shipping_incl_tax":"5.0000",
          "base_shipping_incl_tax":"5.0000",
          "coupon_rule_name":null,
          "gift_message_id":null,
          "paypal_ipn_customer_notified":"0",
          "vendor_order_id":"VN100028",
          "extension_attributes":{
          },
          "items":{"50":
          {
          }
          }
        }
    },
    { "shipping_address":
        {
           "entity_id":"75",
           "parent_id":"77",
           "customer_address_id":null,
           "quote_address_id":"250",
           "region_id":"564",
           "customer_id":null,
           "fax":null,
           "region":"chennai",
           "postcode":"700089",
           "lastname":"Gatto",
           "street":"srinaarat",
           "city":"chennai",
           "email":"test@gmail.com",
           "telephone":"9876543210",
           "country_id":"IN",
           "firstname":"hgd",
           "address_type":"shipping",
           "prefix":"address_","middlename":null,
           "suffix":null,

           "company":"sd",
           "vat_id":null,
           "vat_is_valid":null,
           "vat_request_id":null,
           "vat_request_date":null,
           "vat_request_success":null
        }
    },

    {   "billing_address":
        { 
            "entity_id":"76",
            "parent_id":"77",
            "customer_address_id":"1",
            "quote_address_id":"251",
            "region_id":"564",
            "customer_id":null,
            "fax":null,
            "region":"chennai",
            "postcode":"700034",
            "lastname":"Gatt0",
            "street":"srinagar",
            "city":"chennai",
            "email":"text@gmail.com",
            "telephone":"9848352205",
            "country_id":"IN",
            "firstname":"ridha",
            "address_type":"billing",
            "prefix":null,
            "middlename":null,
            "suffix":null,
            "company":"ridha",
            "vat_id":null,
            "vat_is_valid":null,
            "vat_request_id":null,
            "vat_request_date":null,
            "vat_request_success":null
        }
    },

    {   "vendor":
        { 
            "entity_id":"1",
            "entity_type_id":"9",
            "attribute_set_id":"0",
            "increment_id":"000000009",
            "parent_id":"0",
            "created_at":"2018-10-01 11:09:32",
            "updated_at":"2018-11-27 12:55:57",
            "is_active":"1",
            "website_id":"1",
            "address":"chennai",
            "city":"chennai",
            "zip_code":"700087",
            "customer_id":"1",
            "shop_url":"cf97wksk",
            "status":"approved",
            "group":"general",
            "public_name":"cf97wksk",
            "name":"test",
            "email":"test@gmail.com",
            "contact_number":"9876543210",
            "country_id":"IN",
            "vendor_gstin":"11PGTAU12346Q",
            "gender":"1",
            "region_id":"564"
        }
    },  

    {  "items":
       {"item_id":"50",
       "order_id":"77",
       "parent_item_id":null,
       "quote_item_id":"208",
       "store_id":"1",
       "created_at":"2018-11-28 06:02:09",
       "updated_at":"2018-11-28 06:02:09",
       "product_id":"14",
       "product_type":"simple",
       "product_options":
       {
         "info_buyRequest":
         {"uenc":"aHR0cDovLzE1OS44OS4xNjQuMTM5L2IyYi9idXkxLWtsbS1mYXNoaW9uLW1hbGwtd29tZW4tcy1mYW5jeS1jb3R0b24tc2lsay1zYXJlZS1yZWQteWVsbG93LXNrdS1zcmlwbC0yODU0Lmh0bWw,","product":"14","selected_configurable_option":"","related_product":"","qty":"1"},
         "additional_options":[{"code":"vendor_name","label":"Vendor","value":"cf97wksk"}]},
         "weight":null,
         "is_virtual":"0",
         "sku":"DKSR0000001-1",
         "name":"KLM Fashion Mall Women's Fancy Cotton Silk Saree ( RED & YELLOW )",
         "description":null,
         "applied_rule_ids":null,
         "additional_data":null,
         "is_qty_decimal":"0",
         "no_discount":"0",
         "qty_backordered":null,
         "qty_canceled":"0.0000",
         "qty_invoiced":"0.0000",
         "qty_ordered":"1.0000",
         "qty_refunded":"0.0000",
         "qty_shipped":"0.0000",
         "base_cost":null,
         "price":"1846.6800",
         "base_price":"1846.6800",
         "original_price":"1846.6800",
         "base_original_price":"1846.6800",
         "tax_percent":"5.0000",
         "tax_amount":"294.5500",
         "base_tax_amount":"294.5500",
         "tax_invoiced":"0.0000",
         "base_tax_invoiced":"0.0000",
         "discount_percent":"0.0000",
         "discount_amount":"0.0000",
         "base_discount_amount":"0.0000",
         "discount_invoiced":"0.0000",
         "base_discount_invoiced":"0.0000",
         "amount_refunded":"0.0000",
         "base_amount_refunded":"0.0000",
         "row_total":"1846.6800",
         "base_row_total":"1846.6800",
         "row_invoiced":"0.0000",
         "base_row_invoiced":"0.0000",
         "row_weight":"0.0000",
         "base_tax_before_discount":null,
         "tax_before_discount":null,
         "ext_order_item_id":null,
         "locked_do_invoice":null,
         "locked_do_ship":null,
         "price_incl_tax":"2141.2300",
         "base_price_incl_tax":"2141.2300",
         "row_total_incl_tax":"2141.2300",
         "base_row_total_incl_tax":"2141.2300",
         "discount_tax_compensation_amount":"0.0000",
         "base_discount_tax_compensation_amount":"0.0000",
         "discount_tax_compensation_invoiced":null,
         "base_discount_tax_compensation_invoiced":null,
         "discount_tax_compensation_refunded":null,
         "base_discount_tax_compensation_refunded":null,
         "tax_canceled":null,
         "discount_tax_compensation_canceled":null,
         "tax_refunded":null,
         "base_tax_refunded":null,
         "discount_refunded":null,
         "base_discount_refunded":null,
         "free_shipping":"0",
         "gift_message_id":null,
         "gift_message_available":"0",
         "weee_tax_applied":null,
         "weee_tax_applied_amount":null,
         "weee_tax_applied_row_amount":null,
         "weee_tax_disposition":null,
         "weee_tax_row_disposition":null,
         "base_weee_tax_applied_amount":null,
         "base_weee_tax_applied_row_amnt":null,
         "base_weee_tax_disposition":null,
         "base_weee_tax_row_disposition":null,
         "vendor_id":"1",
         "seller_price":"1679",
         "hsn":"5007",
         "seller_item_total":"1678.80",
         "vendor_tax":"83.94",
         "vendor_row_total":"1762.74",
         "cess_rate":"0.00",
         "product":{},
         "thumbnail":"\/1\/5\/1538546849_sku-sripl-2854_1.png",
    }
    }
    ]

Array
(
    [shipping_address] => Array
        (
            [entity_id] => 1
            [parent_id] => 4
            [customer_address_id] => 1
            [quote_address_id] => 4
            [region_id] => 564
            [customer_id] => 
            [fax] => 
            [region] => Telangana
            [postcode] => 500049
            [lastname] => Latname
            [street] => Road No 23
Deepthisree Nagar Madinaguda
            [city] => India
            [email] => asarush@xmial.com
            [telephone] => 9999999999
            [country_id] => IN
            [firstname] => Aakshay
            [address_type] => shipping
            [prefix] => 
            [middlename] => 
            [suffix] => 
            [company] => Aarush
            [vat_id] => 
            [vat_is_valid] => 
            [vat_request_id] => 
            [vat_request_date] => 
            [vat_request_success] => 
        )

)
Array
(
    [billing_address] => Array
        (
            [entity_id] => 2
            [parent_id] => 4
            [customer_address_id] => 1
            [quote_address_id] => 10
            [region_id] => 564
            [customer_id] => 
            [fax] => 
            [region] => Telangana
            [postcode] => 500076
            [lastname] => Gupta
            [street] => Road No 23
Golkonda
            [city] => Hyderabad
            [email] => fradnsss@gmail.com
            [telephone] => 9999999999
            [country_id] => IN
            [firstname] => Firsthan
            [address_type] => billing
            [prefix] => 
            [middlename] => 
            [suffix] => 
            [company] => Firstname
            [vat_id] => 
            [vat_is_valid] => 
            [vat_request_id] => 
            [vat_request_date] => 
            [vat_request_success] => 
        )

)
Array
(
    [vendor] => Array
        (
            [entity_id] => 1
            [entity_type_id] => 9
            [attribute_set_id] => 0
            [increment_id] => 000000009
            [parent_id] => 0
            [created_at] => 2018-10-01 11:09:32
            [updated_at] => 2018-11-27 12:55:57
            [is_active] => 1
            [website_id] => 1
            [address] => hyyderabad
            [city] => hyderabad
            [zip_code] => 500055
            [customer_id] => 1
            [shop_url] => cf97wksk
            [status] => approved
            [group] => general
            [public_name] => cf97wksk
            [name] => Firstname Lastname
            [email] => testemail@gmail.com
            [contact_number] => 9999999999
            [country_id] => IN
            [vendor_gstin] => 11PGTAU12346Q
            [gender] => 1
            [region_id] => 564
        )

)
在我的控制器中,按如下方式发送要查看的数据:

 $result = json_decode($result_json,true);
 return view('orders.view',compact('result')); 
我需要在我的视图中显示发货地址和账单地址。我该怎么做呢

我希望输出如下所示

[
    {"data":
       {  "entity_id":"77",
          "state":"new",
          "status":"pending",
          "coupon_code":null,
          "protect_code":"ab0fc2890c4c9cc93d7d4586e5dcd8ff",
          "shipping_description":"Flat Rate - Fixed",
          "is_virtual":"0",
          "store_id":"1",
          "customer_id":"2",
          "base_discount_amount":"0.0000",
          "base_discount_canceled":null,
          "base_discount_invoiced":null,
          "base_discount_refunded":null,
          "base_grand_total":"2146.2300",
          "base_shipping_amount":"5.0000",
          "base_shipping_canceled":null,
          "base_shipping_invoiced":null,
          "base_shipping_refunded":null,
          "base_shipping_tax_amount":"0.0000",
          "base_shipping_tax_refunded":null,
          "base_subtotal":"1846.6800",
          "base_subtotal_canceled":null,
          "base_subtotal_invoiced":null,
          "base_subtotal_refunded":null,
          "base_tax_amount":"294.5500",
          "base_tax_canceled":null,
          "base_tax_invoiced":null,
          "base_tax_refunded":null,
          "base_to_global_rate":"1.0000",
          "base_to_order_rate":"1.0000",
          "base_total_canceled":null,
          "base_total_invoiced":null,
          "base_total_invoiced_cost":null,
          "base_total_offline_refunded":null,
          "base_total_online_refunded":null,
          "base_total_paid":null,
          "base_total_qty_ordered":null,
          "base_total_refunded":null,
          "discount_amount":"0.0000",
          "discount_canceled":null,
          "discount_invoiced":null,
          "discount_refunded":null,
          "grand_total":"2146.2300",
          "shipping_amount":"5.0000",
          "shipping_canceled":null,
          "shipping_invoiced":null,
          "shipping_refunded":null,
          "shipping_tax_amount":"0.0000",
          "shipping_tax_refunded":null,
          "store_to_base_rate":"0.0000",
          "store_to_order_rate":"0.0000",
          "subtotal":"1846.6800",
          "subtotal_canceled":null,
          "subtotal_invoiced":null,
          "subtotal_refunded":null,
          "tax_amount":"294.5500",
          "tax_canceled":null,
          "tax_invoiced":null,
          "tax_refunded":null,
          "total_canceled":null,
          "total_invoiced":null,
          "total_offline_refunded":null,
          "total_online_refunded":null,
          "total_paid":null,
          "total_qty_ordered":"1.0000",
          "total_refunded":null,
          "can_ship_partially":null,
          "can_ship_partially_item":null,
          "customer_is_guest":"0",
          "customer_note_notify":"1",
          "billing_address_id":"76",
          "customer_group_id":"1",
          "edit_increment":null,
          "email_sent":null,
          "send_email":"1",
          "forced_shipment_with_invoice":null,
          "payment_auth_expiration":null,
          "quote_address_id":null,
          "quote_id":"72",
          "shipping_address_id":"75",
          "adjustment_negative":null,
          "adjustment_positive":null,
          "base_adjustment_negative":null,
          "base_adjustment_positive":null,
          "base_shipping_discount_amount":"0.0000",
          "base_subtotal_incl_tax":"2141.2300",
          "base_total_due":"2146.2300",
          "payment_authorization_amount":null,
          "shipping_discount_amount":"0.0000",
          "subtotal_incl_tax":"2141.2300",
          "total_due":"2146.2300",
          "weight":"0.0000",
          "customer_dob":null,
          "increment_id":"000000157",
          "applied_rule_ids":null,
          "base_currency_code":"INR",
          "customer_email":"test@gmail.com",
          "customer_firstname":"ridha",
          "customer_lastname":"Gatto",
          "customer_middlename":null,
          "customer_prefix":null,
          "customer_suffix":null,
          "customer_taxvat":null,
          "discount_description":null,
          "ext_customer_id":null,
          "ext_order_id":null,
          "global_currency_code":"INR",
          "hold_before_state":null,
          "hold_before_status":null,
          "order_currency_code":"INR",
          "original_increment_id":null,
          "relation_child_id":null,
          "relation_child_real_id":null,
          "relation_parent_id":null,
          "relation_parent_real_id":null,
          "remote_ip":"193.33.131.226",
          "shipping_method":"flatrate_flatrate",
          "store_currency_code":"INR",
          "store_name":"Main Website\nMain Website Store\n",
          "x_forwarded_for":null,
          "customer_note":null,
          "created_at":"2018-11-28 06:01:59",
          "updated_at":"2018-11-28 06:02:09",
          "total_item_count":"1",
          "customer_gender":"0",
          "discount_tax_compensation_amount":"0.0000",
          "base_discount_tax_compensation_amount":"0.0000",
          "shipping_discount_tax_compensation_amount":"0.0000",
          "base_shipping_discount_tax_compensation_amnt":"0.0000",
          "discount_tax_compensation_invoiced":null,
          "base_discount_tax_compensation_invoiced":null,
          "discount_tax_compensation_refunded":null,
          "base_discount_tax_compensation_refunded":null,
          "shipping_incl_tax":"5.0000",
          "base_shipping_incl_tax":"5.0000",
          "coupon_rule_name":null,
          "gift_message_id":null,
          "paypal_ipn_customer_notified":"0",
          "vendor_order_id":"VN100028",
          "extension_attributes":{
          },
          "items":{"50":
          {
          }
          }
        }
    },
    { "shipping_address":
        {
           "entity_id":"75",
           "parent_id":"77",
           "customer_address_id":null,
           "quote_address_id":"250",
           "region_id":"564",
           "customer_id":null,
           "fax":null,
           "region":"chennai",
           "postcode":"700089",
           "lastname":"Gatto",
           "street":"srinaarat",
           "city":"chennai",
           "email":"test@gmail.com",
           "telephone":"9876543210",
           "country_id":"IN",
           "firstname":"hgd",
           "address_type":"shipping",
           "prefix":"address_","middlename":null,
           "suffix":null,

           "company":"sd",
           "vat_id":null,
           "vat_is_valid":null,
           "vat_request_id":null,
           "vat_request_date":null,
           "vat_request_success":null
        }
    },

    {   "billing_address":
        { 
            "entity_id":"76",
            "parent_id":"77",
            "customer_address_id":"1",
            "quote_address_id":"251",
            "region_id":"564",
            "customer_id":null,
            "fax":null,
            "region":"chennai",
            "postcode":"700034",
            "lastname":"Gatt0",
            "street":"srinagar",
            "city":"chennai",
            "email":"text@gmail.com",
            "telephone":"9848352205",
            "country_id":"IN",
            "firstname":"ridha",
            "address_type":"billing",
            "prefix":null,
            "middlename":null,
            "suffix":null,
            "company":"ridha",
            "vat_id":null,
            "vat_is_valid":null,
            "vat_request_id":null,
            "vat_request_date":null,
            "vat_request_success":null
        }
    },

    {   "vendor":
        { 
            "entity_id":"1",
            "entity_type_id":"9",
            "attribute_set_id":"0",
            "increment_id":"000000009",
            "parent_id":"0",
            "created_at":"2018-10-01 11:09:32",
            "updated_at":"2018-11-27 12:55:57",
            "is_active":"1",
            "website_id":"1",
            "address":"chennai",
            "city":"chennai",
            "zip_code":"700087",
            "customer_id":"1",
            "shop_url":"cf97wksk",
            "status":"approved",
            "group":"general",
            "public_name":"cf97wksk",
            "name":"test",
            "email":"test@gmail.com",
            "contact_number":"9876543210",
            "country_id":"IN",
            "vendor_gstin":"11PGTAU12346Q",
            "gender":"1",
            "region_id":"564"
        }
    },  

    {  "items":
       {"item_id":"50",
       "order_id":"77",
       "parent_item_id":null,
       "quote_item_id":"208",
       "store_id":"1",
       "created_at":"2018-11-28 06:02:09",
       "updated_at":"2018-11-28 06:02:09",
       "product_id":"14",
       "product_type":"simple",
       "product_options":
       {
         "info_buyRequest":
         {"uenc":"aHR0cDovLzE1OS44OS4xNjQuMTM5L2IyYi9idXkxLWtsbS1mYXNoaW9uLW1hbGwtd29tZW4tcy1mYW5jeS1jb3R0b24tc2lsay1zYXJlZS1yZWQteWVsbG93LXNrdS1zcmlwbC0yODU0Lmh0bWw,","product":"14","selected_configurable_option":"","related_product":"","qty":"1"},
         "additional_options":[{"code":"vendor_name","label":"Vendor","value":"cf97wksk"}]},
         "weight":null,
         "is_virtual":"0",
         "sku":"DKSR0000001-1",
         "name":"KLM Fashion Mall Women's Fancy Cotton Silk Saree ( RED & YELLOW )",
         "description":null,
         "applied_rule_ids":null,
         "additional_data":null,
         "is_qty_decimal":"0",
         "no_discount":"0",
         "qty_backordered":null,
         "qty_canceled":"0.0000",
         "qty_invoiced":"0.0000",
         "qty_ordered":"1.0000",
         "qty_refunded":"0.0000",
         "qty_shipped":"0.0000",
         "base_cost":null,
         "price":"1846.6800",
         "base_price":"1846.6800",
         "original_price":"1846.6800",
         "base_original_price":"1846.6800",
         "tax_percent":"5.0000",
         "tax_amount":"294.5500",
         "base_tax_amount":"294.5500",
         "tax_invoiced":"0.0000",
         "base_tax_invoiced":"0.0000",
         "discount_percent":"0.0000",
         "discount_amount":"0.0000",
         "base_discount_amount":"0.0000",
         "discount_invoiced":"0.0000",
         "base_discount_invoiced":"0.0000",
         "amount_refunded":"0.0000",
         "base_amount_refunded":"0.0000",
         "row_total":"1846.6800",
         "base_row_total":"1846.6800",
         "row_invoiced":"0.0000",
         "base_row_invoiced":"0.0000",
         "row_weight":"0.0000",
         "base_tax_before_discount":null,
         "tax_before_discount":null,
         "ext_order_item_id":null,
         "locked_do_invoice":null,
         "locked_do_ship":null,
         "price_incl_tax":"2141.2300",
         "base_price_incl_tax":"2141.2300",
         "row_total_incl_tax":"2141.2300",
         "base_row_total_incl_tax":"2141.2300",
         "discount_tax_compensation_amount":"0.0000",
         "base_discount_tax_compensation_amount":"0.0000",
         "discount_tax_compensation_invoiced":null,
         "base_discount_tax_compensation_invoiced":null,
         "discount_tax_compensation_refunded":null,
         "base_discount_tax_compensation_refunded":null,
         "tax_canceled":null,
         "discount_tax_compensation_canceled":null,
         "tax_refunded":null,
         "base_tax_refunded":null,
         "discount_refunded":null,
         "base_discount_refunded":null,
         "free_shipping":"0",
         "gift_message_id":null,
         "gift_message_available":"0",
         "weee_tax_applied":null,
         "weee_tax_applied_amount":null,
         "weee_tax_applied_row_amount":null,
         "weee_tax_disposition":null,
         "weee_tax_row_disposition":null,
         "base_weee_tax_applied_amount":null,
         "base_weee_tax_applied_row_amnt":null,
         "base_weee_tax_disposition":null,
         "base_weee_tax_row_disposition":null,
         "vendor_id":"1",
         "seller_price":"1679",
         "hsn":"5007",
         "seller_item_total":"1678.80",
         "vendor_tax":"83.94",
         "vendor_row_total":"1762.74",
         "cess_rate":"0.00",
         "product":{},
         "thumbnail":"\/1\/5\/1538546849_sku-sripl-2854_1.png",
    }
    }
    ]

Array
(
    [shipping_address] => Array
        (
            [entity_id] => 1
            [parent_id] => 4
            [customer_address_id] => 1
            [quote_address_id] => 4
            [region_id] => 564
            [customer_id] => 
            [fax] => 
            [region] => Telangana
            [postcode] => 500049
            [lastname] => Latname
            [street] => Road No 23
Deepthisree Nagar Madinaguda
            [city] => India
            [email] => asarush@xmial.com
            [telephone] => 9999999999
            [country_id] => IN
            [firstname] => Aakshay
            [address_type] => shipping
            [prefix] => 
            [middlename] => 
            [suffix] => 
            [company] => Aarush
            [vat_id] => 
            [vat_is_valid] => 
            [vat_request_id] => 
            [vat_request_date] => 
            [vat_request_success] => 
        )

)
Array
(
    [billing_address] => Array
        (
            [entity_id] => 2
            [parent_id] => 4
            [customer_address_id] => 1
            [quote_address_id] => 10
            [region_id] => 564
            [customer_id] => 
            [fax] => 
            [region] => Telangana
            [postcode] => 500076
            [lastname] => Gupta
            [street] => Road No 23
Golkonda
            [city] => Hyderabad
            [email] => fradnsss@gmail.com
            [telephone] => 9999999999
            [country_id] => IN
            [firstname] => Firsthan
            [address_type] => billing
            [prefix] => 
            [middlename] => 
            [suffix] => 
            [company] => Firstname
            [vat_id] => 
            [vat_is_valid] => 
            [vat_request_id] => 
            [vat_request_date] => 
            [vat_request_success] => 
        )

)
Array
(
    [vendor] => Array
        (
            [entity_id] => 1
            [entity_type_id] => 9
            [attribute_set_id] => 0
            [increment_id] => 000000009
            [parent_id] => 0
            [created_at] => 2018-10-01 11:09:32
            [updated_at] => 2018-11-27 12:55:57
            [is_active] => 1
            [website_id] => 1
            [address] => hyyderabad
            [city] => hyderabad
            [zip_code] => 500055
            [customer_id] => 1
            [shop_url] => cf97wksk
            [status] => approved
            [group] => general
            [public_name] => cf97wksk
            [name] => Firstname Lastname
            [email] => testemail@gmail.com
            [contact_number] => 9999999999
            [country_id] => IN
            [vendor_gstin] => 11PGTAU12346Q
            [gender] => 1
            [region_id] => 564
        )

)
发货地址

Firstname Lastname

海得拉巴

Pin码:500072


联系电话:99988777

您不能使用$result->shipping\u地址,因为根据您的输出,该地址是数组

试试下面的一个

echo $result[1]['shipping_address']['firstname'] . ' ' . $result[1]['shipping_address']['lastname'] . ' ' . $result[1]['shipping_address']['city'] . 'Pin code: ' . $result[1]['shipping_address']['postcode'] . ' ' . 'Contact Number : ' .  $result[1]['shipping_address']['telephone'];

我刚刚提供了打印值的选项,您可能需要对变量进行一些验证

谢谢。

在您的控制器中

return view('view-name', [
   'shipping_address' => $shipping_address
    // ...
]);
在view-name.blade.php文件中:

<input id="shipping_address" type="hidden" value="@json($shipping_address)">

请参阅浏览器调试中的控制台日志,您可以执行任何操作。

是否已将控制器中的数据传递给视图?像这个
view('pagename')->带有($data)
您可以共享输入的JSON吗?您如何将其传递给blade,以及如何处理blade模板中的数据?我认为问题在于您的数组结构。尝试访问
$result[0]['shipping\u address']
。在控制器中调用$result=json\u decode($result\u json,true);返回视图('orders.view',compact('result');我试过这个,得到的错误如下..未定义的索引:shipping_address(视图:C:\xampp\htdocs\delta_tool\resources\views\orders\View.blade.php)你能分享你的$result值吗?当你使用时,压缩结果将成为一个键,这样你肯定能访问$result['shipping_address']['firstname']。共享$result值,以便我可以检查更多。检查我的更新。使用
echo$result[1]['shipping_address']['firstname'].'$结果[1]['shipping_address']['lastname'].'$结果[1]['shipping_address']['city'].'Pin码:'$结果[1]['shipping_address']['postcode'].'联络电话:‘$结果[1][“送货地址”][“电话”]有时我可以在1个位置获得发货地址,有时我会在第二个位置获得发货地址。因此,对于某些订单,它有多个发货地址。如果我使用$result[1],那么这将是一个问题。我如何将json解析为$shippng_address…返回视图('view-name',['shipping_address'=>$shipping_address//…]);如果您有json字符串,那么可以使用
$shipping_address_json='{“a”:1,“b”:2,“c”:3,“d”:4,“e”:5}'
$shipping\u address=json\u decode($shipping\u address\u json)
let shipping_address= $('#shipping_address').val();
console.log(shipping_address)