private function marticlehtml($ids = []) { $result = []; $template = new PrintController('online', 'mobile'); foreach ($ids as $id) { $this->getPrecent(); $path = public_path('customers/' . $this->customer . '/mobile/detail/' . $id . '.html'); $template->articlePreview($id); file_put_contents($path, ob_get_contents()); ob_clean(); $result[] = $path; } return $result; }
/** * 手机内容页预览 */ public function marticlePreview($id) { $template = new PrintController('preview', 'mobile'); return $template->articlePreview($id); }
/** * 文章页静态文件生成并返回生成文件名的数组 * * @param array $ids * @return string */ private function articlehtml($ids = [], $type = 'pc') { $template = new PrintController('online', $type); $result = []; foreach ($ids as $id) { $this->getPrecent(); ob_start(); $path = $type == 'pc' ? public_path('customers/' . $this->customer . '/detail/' . $id . '.html') : public_path('customers/' . $this->customer . '/mobile/detail/' . $id . '.html'); echo $template->articlePreview($id); file_put_contents($path, ob_get_contents()); ob_end_clean(); $result[] = $path; } return $result; }