pluginName = 'officeViewerPlugin'; $this->appName = LNG('officeViewer.jsOffice.name'); } public function index(){ $plugin = Action($this->pluginName); if(!$plugin->allowExt('js')) { $plugin->showTips(LNG('officeViewer.main.invalidExt'), $this->appName); } $extList = array( 'docx' => 'mammothjs', 'doc' => 'mammothjs', 'xlsx' => 'luckysheet', // sheetjs 'xls' => 'luckysheet', 'csv' => 'luckysheet', 'pptx' => 'pptxjs', 'ppt' => 'pptxjs', ); // doc、ppt不支持,此处为兼容某些旧格式命名的新结构(zip)文件 $ext = $this->in['ext']; if(!isset($extList[$ext])) { $plugin->showTips(LNG('officeViewer.main.invalidExt'), $this->appName); } $app = $extList[$ext]; $plugin->showJsOffice($app); } }