第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

從PHP客戶端庫訪問數(shù)組以進行精確在線

從PHP客戶端庫訪問數(shù)組以進行精確在線

PHP
藍山帝景 2021-04-26 21:31:51
為了商店訂購某些信息放在客戶從WooCommerce REST API,以通過精確的在線儀表盤REST API。我已經將PHP Client庫用于Exact Online。盡管存在問題-將數(shù)據(jù)存儲到Exact Online之后,無法訪問數(shù)組中的特定字段。具體來說,當使用/api/v1/{division}/bulk/CRM/Accounts? $filter=ID eq Email eq'nishanth@gmail.com'&$select=ID,Email或者$url = "https://start.exactonline.de/api/v1/" + mandant.number + "/crm/Accounts?$filter=Email eq '" + orderitem.email + "'&$select=ID,Code";在這里,您將獲得以下代碼$customer = [        'address'       => 'No.22/N, 91 Cross, XYZ Street, ABC Road',        'address2'      => 'DEF',        'city'          => 'GHI',        'customerid'    => '999',        'country'       => 'DE',        'name'          => 'Nishanth',        'zipcode'       => '123456'];// Create a new account$account->AddressLine1 = $customer['address'];$account->AddressLine2 = $customer['address2'];$account->City = $customer['city'];$account->Code = $customer['customerid'];$account->Country = $customer['country'];$account->IsSales = 'true';$account->Name = $customer['name'];$account->Postcode = $customer['zipcode'];$account->Email = 'nishanth@gmail.com';$account->Status = 'C';$account->save();這是使用電子郵件ID過濾后獲得的結果盡管使用以下內置函數(shù)進行了調用:$Accounts->filter("Email eq 'nishanth@gmail.com'")[0]->findWithSelect('ID');$checkAccount = $Accounts->filter("Email eq 'nishanth@gmail.com'");$checkAccount[0]->find('ID');$checkAccount[0]->findWithSelect('Code'); 上面內置的庫導致[attributes:protected] => Array ( )我應該如何從數(shù)組訪問特定屬性?同樣,CurrentDivision通過諸如$getCurrentDivision->findWithSelect('CurrentDivision');或的調用也可以輕松地從庫中檢索。$getDivision->CurrentDivision;檢索數(shù)組后,為什么同一個函數(shù)不能正常工作?
查看完整描述

2 回答

?
哈士奇WWW

TA貢獻1799條經驗 獲得超6個贊

您可以使用閉包綁定方法訪問對象的私有或受保護的屬性。這是一個靜態(tài)函數(shù)示例。


class Helper {


    /**

    * Helper method to access private

    * or protected properties of an object

    * using the closure bind method

    */

    public static function accessPrivate($object, $property) {

        $bind = Closure::bind(

            function($prop) {

                return $this->$prop;

            },

            $object,

            $object

        );

        return $bind($property);

    }

}

用途:


$code = Helper::accessPrivate($checkAccount, "Code");


查看完整回答
反對 回復 2021-05-07
?
Cats萌萌

TA貢獻1805條經驗 獲得超9個贊

為了從數(shù)組訪問受保護的屬性,您將在下面的代碼片段中找到


$checkAccount = $Accounts->filter("Email eq 'nishanth@gmail.com'");

$getAccountId = $checkAccount[0]->ID;

$getAccountCode = $checkAccount[0]->Code;

由于我嘗試了findWithSelect()和find():


$Accounts->filter("Email eq 'nishanth@gmail.com'")[0]->findWithSelect('ID');

但是沒有產生任何值導致空白值


查看完整回答
反對 回復 2021-05-07
  • 2 回答
  • 0 關注
  • 174 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網(wǎng)微信公眾號