注意对象转换

时间:2017-10-22 01:16:45

标签: php

我正在为eBay-API做一个搜索引擎,虽然我无法弄清楚我在这里做错了什么,我得到的错误是:

  

注意:尝试在第431行的D:\ xamp \ htdocs \ webapp \ queries.php中获取非对象的属性

431是:

if ($darkarteli->Item->SellingStatus->CurrentPrice <= 10 && $darkarteli->Item->SellingStatus->CurrentPrice >= 25 && $darkarteli->ListingType == 'FixedPriceItem')

完整的代码段:

foreach ($temparrrayforproducts as $darkartelis){
    global $itemidsfromgetsellerlist;
    $nd=[];
    array_push($nd, $darkartelis->ItemArray);
    foreach($nd as $darkartelis->Item){
        if ($darkarteli->Item->SellingStatus->CurrentPrice <= 10 && $darkarteli->Item->SellingStatus->CurrentPrice >= 25 && $darkarteli->ListingType == 'FixedPriceItem'){
            array_push($itemidsfromgetsellerlist, $darkarteli->Item->ItemID);
        }
    }
}

var_dump ($itemidsfromgetsellerlist);

var_dump()https://pastebin.com/xi34Vzn7

美化$darkartelis

编辑:我尝试了这段代码并没有发出任何错误,但它没有通过if语句,即使有10-25个定价商品也是fixedpriceitems < / p>

foreach($temparrrayforproducts as $ndd){//pro kiekviena getsellerlist
    global $itemidsfromgetsellerlist;
    $nd=[];
    array_push($nd, $ndd->ItemArray->Item); // tada per get seller list item arr
    foreach($nd as $k=>$nds){ // per kiekviena itema
        if (is_object($nds)&&!empty($nds)){
            if ($nds->SellingStatus->CurrentPrice <= 10.00 && $nds->SellingStatus->CurrentPrice >= 25.00 && $nds->ListingType == 'FixedPriceItem'){
                echo "Hallelujah";
                array_push($itemidsfromgetsellerlist, $nds->ItemID);
            }
        }
    }
}

0 个答案:

没有答案