无法解释以下问题:我有一个PHP函数返回以下数组。当我在函数中执行Print_r时,数组回声如下:
.div.divanimated
如果我从另一个php调用该函数时返回该数组,然后print_r响应。有一些价值观丢失了。这里的值“color”和“bildpfad”和数组如下所示:
Array ( [title] => Even&Odd Shopper Bag Handtasche Damen in Schwarz [brand] => Even&Odd [category] => Shoes [ProductTypeName] => HANDBAG [Department] => Damen [bildpfad] => https://images-eu.ssl-images-amazon.com/images/I/31w5kOgS2BL.jpg [Prices] => Array ( [Var_HighestSalePrice] => [Var_LowestSalePrice] => [Var_HighestPrice] => [Var_LowestPrice] => [Offer_HighestPrice] => [Offer_LowestPrice] => 2495 [uvp] => 2995 ) [Discount] => 17 [available] => in stock [Color] => Schwarz [error] => )
我尝试了几乎所有的东西都有添加条纹,修剪字段等等。任何想法可能是什么?
更新:功能
Array ( [title] => Even&Odd Shopper Bag - Handtasche Damen in Schwarz, Rot, Blau o. Cognac-Braun - Tasche aus Kunstleder mit Reißverschluss & Handyfach [brand] => Even&Odd [category] => Shoes [ProductTypeName] => HANDBAG [Department] => Damen [bildpfad] => [Prices] => Array ( [Var_HighestSalePrice] => [Var_LowestSalePrice] => 2495 [Var_HighestPrice] => 2995 [Var_LowestPrice] => 2995 [Offer_HighestPrice] => [Offer_LowestPrice] => [uvp] => ) [Discount] => [available] => in stock [Color] => [error] => )
调用函数并打印结果:
function getAmazonData($region, $asin) {
$xml = aws_signed_request($region, array(
"Operation" => "ItemLookup",
"ItemId" => $asin,
"IncludeReviewsSummary" => False,
"ResponseGroup" => "Images,ItemAttributes,OfferFull,VariationSummary",
'MerchantId' => 'All'
));
$error= $xml->Items->Request->Errors;
$item = $xml->Items->Item;
$response = array(
"title" => htmlentities((string) $item->ItemAttributes->Title),
"brand" => htmlentities((string) $item->ItemAttributes->Brand),
"category" => htmlentities((string) $item->ItemAttributes->ProductGroup),
"ProductTypeName" => htmlentities((string) $item->ItemAttributes->ProductTypeName),
"Department" => htmlentities((string) $item->ItemAttributes->Department),
"bildpfad"=> htmlentities((string) $item->LargeImage->URL),
"Prices" => array(
"Var_HighestSalePrice" => htmlentities((string) $item->VariationSummary->HighestSalePrice->Amount),
"Var_LowestSalePrice" => htmlentities((string) $item->VariationSummary->LowestSalePrice->Amount),
"Var_HighestPrice" => htmlentities((string) $item->VariationSummary->HighestPrice->Amount),
"Var_LowestPrice" => htmlentities((string) $item->VariationSummary->LowestPrice->Amount),
"Offer_HighestPrice" => htmlentities((string) $item->OfferSummary->HighestNewPrice->Amount),
"Offer_LowestPrice" => htmlentities((string) $item->OfferSummary->LowestNewPrice->Amount),
"uvp" => htmlentities((string) $item->ItemAttributes->ListPrice->Amount)
),
"Discount" => htmlentities((string) $item->Offers->Offer->OfferListing->PercentageSaved),
"available"=> "in stock",
"Color" => htmlentities((string) $item->ItemAttributes->Color),
"error" => htmlentities((string) $error->Error->Code)
);
Print_r($response);
return $response;
};