久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放AV片

<center id="vfaef"><input id="vfaef"><table id="vfaef"></table></input></center>

    <p id="vfaef"><kbd id="vfaef"></kbd></p>

    
    
    <pre id="vfaef"><u id="vfaef"></u></pre>

      <thead id="vfaef"><input id="vfaef"></input></thead>

    1. 站長(zhǎng)資訊網(wǎng)
      最全最豐富的資訊網(wǎng)站

      php如何獲取私有屬性的值

      采用laravel的chunkById段落查詢方法,一次查詢2K,然后批量入庫,由于這個(gè)表沒啥改動(dòng),可以直接查詢后導(dǎo)入

      遇到的問題是,查詢后的數(shù)據(jù)屬性是一個(gè)數(shù)組,要手動(dòng)組裝下才能直接入庫,字段有點(diǎn)多,試想能不能直接拿到這個(gè)屬性數(shù)據(jù)然后丟到數(shù)組里直接入庫

      查詢出的數(shù)據(jù)是這樣(推薦:《php視頻教程》)
      php如何獲取私有屬性的值

      是私有屬性

      直接 (array)$value 后是這樣
      php如何獲取私有屬性的值

      那么直接
      $arrTemp['x00*x00attributes']應(yīng)該就可以,試了下確實(shí)行

      封裝下:

      public function getProtectedValue($obj, $name) {     $array = (array)$obj;     $prefix = chr(0).'*'.chr(0);     return $array[$prefix.$name]; }

      截圖中x00對(duì)應(yīng)的ASCII碼為0,用chr將0的ASCII碼轉(zhuǎn)換為字符串,即chr(0)對(duì)應(yīng)ASCII碼為x00,然后拼接下*就OK

      調(diào)整后的代碼為

      $arrTemp = $this->getProtectedValue($value, 'attributes');

      贊(0)
      分享到: 更多 (0)
      網(wǎng)站地圖   滬ICP備18035694號(hào)-2    滬公網(wǎng)安備31011702889846號(hào)