叶测试 - 2025年8月
type: channel
link: https://r1989.com/2025/08/
description: Rebuild 1989
items: 使用phpword读取word中的文本、表格等内容
items: 瀚高数据库安全版安装license

使用phpword读取word中的文本、表格等内容
type: item
date: 2025-08-27T06:35:24+00:00
description: phpword读取word中的内容，调用deepseek后生成word下载，代码如下： <?php /** * Desc: * User: SenSen Wechat:1050575278 * Date: 2025-8-27 * Time: 11:02 */ namespace app\index\controller\service; use app\index\controller\Auth; use PhpOffice\PhpWord\IOFactory; use PhpOffice\PhpWord\PhpWord; use PhpOffice\PhpWord\SimpleType\Jc; use sensen\services\HttpService; use sensen\services\JsonService; use sensen\services\upload\Upload; class QiSuZhuang extends Auth { /** * 诉状上传 */ public function upload() { $upload_type = $this->request->get('upload_type', sys_config('upload_type', 1)); try { $path = make_path('qisuzhuang', 2, true); $upload = new Upload((int)$upload_type, [ 'accessKey' => sys_config('accessKey'), 'secretKey' => sys_config('secretKey'), 'uploadUrl' => sys_config('uploadUrl'), 'storageName' => sys_config('storage_name'), 'storageRegion' => sys_config('storage_region'), ]); //验证类型 $res = $upload->to($path)->validate(['fileExt'=>'doc,docx', 'fileMime'=>['application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/msword']])->move('file'); if ($res === false) { return JsonService::fail('上传失败：' . $upload->getError()); } else { $fileInfo = $upload->getUploadInfo(); if ($fileInfo) { $file = '.'.$fileInfo['dir']; $phpWord = IOFactory::load($file); $sections = $phpWord->getSections(); $szContent = ''; foreach ($sections as $section) { $elements = $section->getElements(); // 获取当前section的所有元素 foreach ($elements as $element) { if ($element instanceof \PhpOffice\PhpWord\Element\TextRun) { // 文本段落 foreach ($element->getElements() as $ele) { $szContent .= self::getTextNode($ele) . "\n"; } }else if ($element instanceof \PhpOffice\PhpWord\Element\Table) { foreach ($element->getRows() as $ele) { $szContent .= self::getTableNode($ele) . "\n"; } } } } $deepSeekContent = $this->getDeepSeekContent($szContent); debug_file($deepSeekContent, 'qisuzhuang'); $fileName = date('YmdHis'); $this->generateQszWord($deepSeekContent, $fileName); return JsonService::successful('上传成功', ['path'=>…

瀚高数据库安全版安装license
type: item
date: 2025-08-16T01:32:43+00:00
description: 瀚高数据库安全版 V4.5.8 以及后续版本，license 文件可分别管控瀚高安全版数据库、瀚高高可用集群(db_ha)，瀚高读写分离集群(hg_proxy)。上传 license将 license文件上传到服务器任意目录下检查 license使用 hg_lic -c -F $filepath 来对指定 $filepath license 文件进行检查操作，该操作将会输出对 license 文件的检查结果，如果检查出现问题，将会提示 license 文件异常。如果一切正常将会输出 license 信息，包括 license 编号、license 状态、用户信息、授权方式、授权用途、申请日期、产品名称、产品版本、产品有效期。chmod 0600 /opt/highgo/hgdb-see-4.5.8/etc/lic/hgdb.lic hg_lic -c -F /opt/highgo/hgdb-see-4.5.8/etc/lic/hgdb.lic加载license使用 hg_lic -l -P $HGDB_HOME -F $filepath 来对指定文件 $filepath 进行加载操作，若配置了 $HGDB_HOME 环境变量，-P 参数可以省略。该操作会对许可证文件进行检查，如果许可证文件异常，将会提示。如果许可证一切正常，该操作会将许可证文件加载到数据库中。