select()->toArray(); foreach($list as $value) { $uuid = md5(time()); $html = $value['content']; $this->start(); $wordname = $uuid.'/article/'.$value['title'].".doc"; echo $html; $this->save($wordname); } } catch (\Exception $e) { dd($e); } } function start() { ob_start(); echo ''; } function save($path) { echo ""; $data = ob_get_contents(); ob_end_clean(); $this->wirtefile($path, $data); } function wirtefile($fn, $data) { $fp = fopen($fn, "wb"); fwrite($fp, $data); fclose($fp); } }