読者です 読者をやめる 読者になる 読者になる

Coding Memos

try {coding} catch {questions}

オブジェクトから値が取れない・・・【どなたか、助けてください〜】

phpでオブジェクトの値取得に悩んでいます。 詳しい方、ぜひ教えてください!!

var_dump($spreadsheet)すると 以下のように出るんですが、 コード中の、Microsoft Corporation っていう値をとる時ってどうすれば良いですか?

object(PhpOffice\PhpSpreadsheet\Spreadsheet)#172 (15) {

  ["uniqueID":"PhpOffice\PhpSpreadsheet\Spreadsheet":private]=>
  string(13) "58c633b7ec087"
  
  ["properties":"PhpOffice\PhpSpreadsheet\Spreadsheet":private]=>
  object(PhpOffice\PhpSpreadsheet\Document\Properties)#188 (12) {
    ["creator":"PhpOffice\PhpSpreadsheet\Document\Properties":private]=>
    string(15) "Unknown Creator"
    ["lastModifiedBy":"PhpOffice\PhpSpreadsheet\Document\Properties":private]=>
    string(15) "Unknown Creator"
    ["created":"PhpOffice\PhpSpreadsheet\Document\Properties":private]=>
    int(1489384376)
    ["modified":"PhpOffice\PhpSpreadsheet\Document\Properties":private]=>
    int(1489384376)
    ["title":"PhpOffice\PhpSpreadsheet\Document\Properties":private]=>
    string(20) "Untitled Spreadsheet"
    ["description":"PhpOffice\PhpSpreadsheet\Document\Properties":private]=>
    string(0) ""
    ["subject":"PhpOffice\PhpSpreadsheet\Document\Properties":private]=>
    string(0) ""
    ["keywords":"PhpOffice\PhpSpreadsheet\Document\Properties":private]=>
    string(0) ""
    ["category":"PhpOffice\PhpSpreadsheet\Document\Properties":private]=>
    string(0) ""
    ["manager":"PhpOffice\PhpSpreadsheet\Document\Properties":private]=>
    string(0) ""
    ["company":"PhpOffice\PhpSpreadsheet\Document\Properties":private]=>
    string(21) "Microsoft Corporation" <-これとりたい
    ["customProperties":"PhpOffice\PhpSpreadsheet\Document\Properties":private]=>
    array(0) {
    }
  }
}

追記

と、ファガイさん(@fagai )やネヌユルさん(@ncaq)に助けてもらったのですが、また詰まってしまいました。

object(PhpOffice\PhpSpreadsheet\Spreadsheet)#172 (15) {
  ["uniqueID":"PhpOffice\PhpSpreadsheet\Spreadsheet":private]=>
  string(13) "58c6524a84fa5"
  ["properties":"PhpOffice\PhpSpreadsheet\Spreadsheet":private]=>
  object(PhpOffice\PhpSpreadsheet\Document\Properties)#188 (12) {
    ["creator":"PhpOffice\PhpSpreadsheet\Document\Properties":private]=>
    string(15) "Unknown Creator"
    ["lastModifiedBy":"PhpOffice\PhpSpreadsheet\Document\Properties":private]=>
    string(15) "Unknown Creator"
    ["created":"PhpOffice\PhpSpreadsheet\Document\Properties":private]=>
    int(1489392202)
    ["modified":"PhpOffice\PhpSpreadsheet\Document\Properties":private]=>
    int(1489392202)
    ["title":"PhpOffice\PhpSpreadsheet\Document\Properties":private]=>
    string(20) "Untitled Spreadsheet"
    ["description":"PhpOffice\PhpSpreadsheet\Document\Properties":private]=>
    string(0) ""
    ["subject":"PhpOffice\PhpSpreadsheet\Document\Properties":private]=>
    string(0) ""
    ["keywords":"PhpOffice\PhpSpreadsheet\Document\Properties":private]=>
    string(0) ""
    ["category":"PhpOffice\PhpSpreadsheet\Document\Properties":private]=>
    string(0) ""
    ["manager":"PhpOffice\PhpSpreadsheet\Document\Properties":private]=>
    string(0) ""
    ["company":"PhpOffice\PhpSpreadsheet\Document\Properties":private]=>
    string(21) "Microsoft Corporation"
    ["customProperties":"PhpOffice\PhpSpreadsheet\Document\Properties":private]=>
    array(0) {
    }
  }
  // 途中略

  ["workSheetCollection":"PhpOffice\PhpSpreadsheet\Spreadsheet":private]=>
  array(1) {
    [0]=>
    object(PhpOffice\PhpSpreadsheet\Worksheet)#176 (40) {
      ["parent":"PhpOffice\PhpSpreadsheet\Worksheet":private]=>
      *RECURSION*
      ["cellCollection":"PhpOffice\PhpSpreadsheet\Worksheet":private]=>
      object(PhpOffice\PhpSpreadsheet\CachedObjectStorage\Memory)#177 (5) {
        ["parent":protected]=>
        *RECURSION*
        ["currentObject":protected]=>
        NULL
        ["currentObjectID":protected]=>
        string(3) "GF6"
        ["currentCellIsDirty":protected]=>
        bool(true)
        ["cellCache":protected]=>
        array(573) {
          ["A2"]=>
          object(PhpOffice\PhpSpreadsheet\Cell)#260 (6) {
            ["value":"PhpOffice\PhpSpreadsheet\Cell":private]=>
            string(25) "test17270301-100000003644" <-これをとりたい・・・。
            ["calculatedValue":"PhpOffice\PhpSpreadsheet\Cell":private]=>
            NULL //以下略