searchMailbox('FROM txt.voice.google.com'); // $mail_info = $mailbox->getMailsInfo($mail_ids); $mail_info=[]; $mail_ids=array_reverse($mail_ids); $i=0; $cache = new FileCache([ 'root' => APP_DIR.'/cache', // Cache root 'ttl' => 0, // Time to live 'compress' => false, // Compress data with gzcompress or not 'serialize' => 'json', // How to serialize data: json, php, raw ]); foreach ($mail_ids as $mail_id) { if ($i>=3){ break; } $i++; $detail=$cache->get($mail_id); if (!$detail){ $detail = $mailbox->getMail($mail_id); $cache->set($mail_id, $detail); } $txt=explode("\r\n", $detail->textPlain); $temp=[ 'subject' => $detail->subject, 'content' => $txt[1], 'from' => $detail->fromAddress, 'fromName' => $detail->fromName, 'replyTo' => $detail->replyTo, 'date' => $detail->date, 'cc' => $detail->cc, 'bcc' => $detail->bcc, ]; $mail_info[]=$temp; } $this->result=$mail_info; $this->render(); } /** * Post Method|新增数据 * @return void */ protected function postData() { } /** * Put Method|更新数据 * @return void */ protected function putData() { } /** * Delete Method|删除数据 * @return void */ protected function deleteData() { } }