不知道如何用PHP解析这个对象

时间:2017-12-13 02:19:18

标签: php parsing object

我正在尝试使用[pic][1] 解析以下对象,但我从未遇到过像PHP这样的对象,如下所示

我需要在keys内获取['users'],但当我_objectData:LazyJsonMapper\LazyJsonMapper:private时,它会失败。我该怎么称呼它?

任何正确方向的提示都将受到赞赏, 感谢

$myobject->_objectData:LazyJsonMapper\LazyJsonMapper:private

2 个答案:

答案 0 :(得分:2)

$account = json_decode($account);
$account->user;
$account->user->username;

答案 1 :(得分:0)

试试这个:

function countboldcells() {
  var book = SpreadsheetApp.getActiveSpreadsheet();
  var sheet = book.getActiveSheet();
  var range_input = sheet.getRange("E2:S7"); 
  var range_output = sheet.getRange("G14");
  var cell_styles = range_input.getFontWeights(); // getFontStyle can only return 'italic' or 'normal'
  var count = 0;

  for(var r = 0; r < cell_styles.length; r++) {
    for(var c = 0; c < cell_styles[0].length; c++) { // isBold is a method for Google Documents only (not sheets) 
      if(cell_styles[r][c] === "bold") { // you need at least two '=' signs // also include the index of cell_styles
        count = count + 1; // count += 1 would also work
      }
    }
  }
  range_output.setValue(count); // make sure you setValue only when booth loops are done.
}