-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.json
1 lines (1 loc) · 71.1 KB
/
index.json
1
[{"content":"DayN 越来越忙,前几天查看论坛发现,其实目前组的raid1机械硬盘存储库最快也就200MB,因为是同时拷贝同一份文件到两块硬盘,就算加了SSD缓存等SSD缓存的空间用完还是会降速到机械硬盘的速度(因为缓存用完后群晖会将文件直接写入存储池)。 而测试群晖ssd缓存的回写速度最快才10~MB/S。 谢特! 想在现在的基础上加速,只能更换读写速度更快的存储设备或者更改为raid10(在raid1的基础上应用raid0组成条带空间。一份文件会被切分成多份存储到不同硬盘中,这样同时写入的理论速度将会成倍增加). 先这样吧,等老板回来后再给他说,看他升不升级。\nDay8 今日将将所有硬盘取出手动降级dsm到6.2.4,终于看见了跳过连续IO选项,遂取消勾选。再次测试,哦豁,虽然是在往缓存中写入数据了,不过速度还是依旧200多MB,下载倒是快了,最快的可以达到1GB每秒。先这样。\n堆叠线也到了,刚好插上测试电脑对接的模块及线的问题\u0026hellip;.\n哦豁,速度还是只有200多MB,排除光模块及线的问题,现在需要去找电脑或者网卡的问题,不过我也注意到一点,在这两台特别慢的电脑上,如果对该电脑进行网络写操作,电脑将变的很卡,虽然在任务管理器中监视设备性能并没有发现短板,但是卡顿现象确实发生了,对比不卡的电脑,除了硬件不一致外操作系统也没更新,晚上更新下系统试试。\nDay7 工作繁忙,暂时无暇顾及网络,暂时搁置问题排查,等前两天买的成品万兆堆叠线到货后再次短接测试。排除线材及光模块的问题。 上班时想到查看硬盘写入,遂打开群晖资源管理对硬盘写入进行监控,同时拷贝文件到相应存储池,发现缓存完全不参与。 沟通群晖官方,DSM7+无法缓存连续IO,哦豁\u0026hellip; 手动降级安装dsm6版本。\nDay6 怀疑部分硬件问题,尝试将两台电脑对接,使用iperf及smb文件传输测速。OMG!速度不达标,还是只有200MB/S。 继续查找问题所在\u0026hellip;\u0026hellip;\nDay5 网卡到货,安装测试。 好家伙,速度没有丝毫提升,开始头疼。 对网卡属性进行配置,开巨型帧,关传输缓存,关闭远程分差api。无效果。 用最高配置电脑使用Homebox测速,能跑满宽带。iperf还是无法跑满宽带。\nDay4 查找了一天的问题,发现买的网卡是pcie x8的,电脑的pcie是x4的,怀疑可能是带宽不够,看到一块tp的tl-nt521f单口万兆网卡,购买等到货。\nDay3 所有光纤全部到位,开始安装硬件设备,先安装三台电脑的万兆网卡,安装路由器及相关光模块。 安装群晖nas硬盘,配置两块m2做RAID1缓存阵列,两块16T硬盘做RAID1数据盘。 对局域网宽带测速 问题来了,不管用iperf测试还是smb本地文件传输均无法达到万兆,最大速度才200MB/S。开始找问题。\nDay2 硬件基本到货,开始安装。 先把光纤走好,下午请宽带运营商师傅来进行熔纤。\nDay1 配件陆陆续续到货,暂时无法安装。\n起因 由于公司存储视频素材的硬盘坏的很快,所以计划购买群晖NAS做素材仓库并挂载到电脑进行工程备份。 领导决定使用群晖DS1821+做NAS,购买万兆路由器及相应网卡做万兆局域网。 以下是具体配置单:\n定位 品牌 数量 NAS 群晖DS1821+ 1 缓存盘 致态TiPlus 7100 1TB 2 存储盘 西数 HC550 16T 2 NAS拓展卡 intelx520SR1DA2 1 路由器 TL-R6812TP-AC 1 光模块 TL-SM512LM-300m 6 跳线 单模双芯2.0mm 2 光转电口模块 ZK-10G-TX 1 光纤 山泽 4芯OM3万兆室内100M 1 ups 雷迪司H1000M 1 网卡 万兆通(10Gtek) X520-DA1 3 ","permalink":"https://zynismus16.github.io/posts/110/","summary":"DayN 越来越忙,前几天查看论坛发现,其实目前组的raid1机械硬盘存储库最快也就200MB,因为是同时拷贝同一份文件到两块硬盘,就算加了SSD缓","title":"升级局域网并安装群晖nas"},{"content":"安装rclone插件 应用中搜索rclone 选择这个插件安装,其他两个为docker 安装完成后会出现在设置-用户实用程序中 连接网盘 微软网盘 因Unraid没有浏览器 所以rclone无法直接获取code来连接网盘 我们采用这种的方式来,在windows上获取config内容 下载个客户端 假设解压到c盘根目录\nC:\\Users\\Administrator\u0026gt;cd c:\\rclone\r切换到解压目录\nc:\\rclone\u0026gt;rclone config\r开始配置\nNo remotes found - make a new one\rn) New remote\rs) Set configuration password\rq) Quit config\rn/s/q\u0026gt; n\r选择n新建\nname\u0026gt; onedrive\r建立个名称\nType of storage to configure.\rEnter a string value. Press Enter for the default (\u0026quot;\u0026quot;).\rChoose a number from below, or type in your own value\r1 / 1Fichier\r\\ \u0026quot;fichier\u0026quot;\r2 / Alias for an existing remote\r\\ \u0026quot;alias\u0026quot;\r3 / Amazon Drive\r\\ \u0026quot;amazon cloud drive\u0026quot;\r4 / Amazon S3 Compliant Storage Providers including AWS, Alibaba, Ceph, Digital Ocean, Dreamhost, IBM COS, Minio, and Tencent COS\r\\ \u0026quot;s3\u0026quot;\r5 / Backblaze B2\r\\ \u0026quot;b2\u0026quot;\r6 / Box\r\\ \u0026quot;box\u0026quot;\r7 / Cache a remote\r\\ \u0026quot;cache\u0026quot;\r8 / Citrix Sharefile\r\\ \u0026quot;sharefile\u0026quot;\r9 / Compress a remote\r\\ \u0026quot;compress\u0026quot;\r10 / Dropbox\r\\ \u0026quot;dropbox\u0026quot;\r11 / Encrypt/Decrypt a remote\r\\ \u0026quot;crypt\u0026quot;\r12 / Enterprise File Fabric\r\\ \u0026quot;filefabric\u0026quot;\r13 / FTP Connection\r\\ \u0026quot;ftp\u0026quot;\r14 / Google Cloud Storage (this is not Google Drive)\r\\ \u0026quot;google cloud storage\u0026quot;\r15 / Google Drive\r\\ \u0026quot;drive\u0026quot;\r16 / Google Photos\r\\ \u0026quot;google photos\u0026quot;\r17 / Hadoop distributed file system\r\\ \u0026quot;hdfs\u0026quot;\r18 / Hubic\r\\ \u0026quot;hubic\u0026quot;\r19 / In memory object storage system.\r\\ \u0026quot;memory\u0026quot;\r20 / Jottacloud\r\\ \u0026quot;jottacloud\u0026quot;\r21 / Koofr\r\\ \u0026quot;koofr\u0026quot;\r22 / Local Disk\r\\ \u0026quot;local\u0026quot;\r23 / Mail.ru Cloud\r\\ \u0026quot;mailru\u0026quot;\r24 / Mega\r\\ \u0026quot;mega\u0026quot;\r25 / Microsoft Azure Blob Storage\r\\ \u0026quot;azureblob\u0026quot;\r26 / Microsoft OneDrive\r\\ \u0026quot;onedrive\u0026quot;\r27 / OpenDrive\r\\ \u0026quot;opendrive\u0026quot;\r28 / OpenStack Swift (Rackspace Cloud Files, Memset Memstore, OVH)\r\\ \u0026quot;swift\u0026quot;\r29 / Pcloud\r\\ \u0026quot;pcloud\u0026quot;\r30 / Put.io\r\\ \u0026quot;putio\u0026quot;\r31 / QingCloud Object Storage\r\\ \u0026quot;qingstor\u0026quot;\r32 / SSH/SFTP Connection\r\\ \u0026quot;sftp\u0026quot;\r33 / Sugarsync\r\\ \u0026quot;sugarsync\u0026quot;\r34 / Tardigrade Decentralized Cloud Storage\r\\ \u0026quot;tardigrade\u0026quot;\r35 / Transparently chunk/split large files\r\\ \u0026quot;chunker\u0026quot;\r36 / Union merges the contents of several upstream fs\r\\ \u0026quot;union\u0026quot;\r37 / Webdav\r\\ \u0026quot;webdav\u0026quot;\r38 / Yandex Disk\r\\ \u0026quot;yandex\u0026quot;\r39 / Zoho\r\\ \u0026quot;zoho\u0026quot;\r40 / http Connection\r\\ \u0026quot;http\u0026quot;\r41 / premiumize.me\r\\ \u0026quot;premiumizeme\u0026quot;\r42 / seafile\r\\ \u0026quot;seafile\u0026quot;\rStorage\u0026gt; 26\r如要连接谷歌的盘,根据标识选择26(版本不同,序号不一定一样,按实际标识选择)\n** See help for onedrive backend at: https://rclone.org/onedrive/ **\rOAuth Client Id\rLeave blank normally.\rEnter a string value. Press Enter for the default (\u0026quot;\u0026quot;).\rclient_id\u0026gt;\r不输入,直接回车\nOAuth Client Secret\rLeave blank normally.\rEnter a string value. Press Enter for the default (\u0026quot;\u0026quot;).\rclient_secret\u0026gt;\r不输入,直接回车\nChoose national cloud region for OneDrive.\rEnter a string value. Press Enter for the default (\u0026quot;global\u0026quot;).\rChoose a number from below, or type in your own value\r1 / Microsoft Cloud Global\r\\ \u0026quot;global\u0026quot;\r2 / Microsoft Cloud for US Government\r\\ \u0026quot;us\u0026quot;\r3 / Microsoft Cloud Germany\r\\ \u0026quot;de\u0026quot;\r4 / Azure and Office 365 operated by 21Vianet in China\r\\ \u0026quot;cn\u0026quot;\rregion\u0026gt; 1\r选择1\nEdit advanced config? (y/n)\ry) Yes\rn) No (default)\ry/n\u0026gt; n\r选择n,不编辑\nRemote config\rUse auto config?\r* Say Y if not sure\r* Say N if you are working on a remote or headless machine\ry) Yes (default)\rn) No\ry/n\u0026gt; y\r选择1自动配置\nIf your browser doesn't open automatically go to the following link: http://127.0.0.1:53682/auth?state=FDOLLiSz***rSJBbag\rLog in and authorize rclone for access\rWaiting for code...\rGot code\r点击链接,登陆账户,授权给rclone使用,脚本自动获取code\nChoose a number from below, or type in an existing value\r1 / OneDrive Personal or Business\r\\ \u0026quot;onedrive\u0026quot;\r2 / Root Sharepoint site\r\\ \u0026quot;sharepoint\u0026quot;\r3 / Sharepoint site name or URL (e.g. mysite or https://contoso.sharepoint.com/sites/mysite)\r\\ \u0026quot;url\u0026quot;\r4 / Search for a Sharepoint site\r\\ \u0026quot;search\u0026quot;\r5 / Type in driveID (advanced)\r\\ \u0026quot;driveid\u0026quot;\r6 / Type in SiteID (advanced)\r\\ \u0026quot;siteid\u0026quot;\r7 / Sharepoint server-relative path (advanced, e.g. /teams/hr)\r\\ \u0026quot;path\u0026quot;\rYour choice\u0026gt; 1\r选择1\nFound 1 drives, please select the one you want to use:\r0: OneDrive (business) id=b!jC7ndQM3XkO5C6RFjk8FC0l6JPipknpLuC4BB4ohz64u3aY5OQn_T4Vh-Rr-ZaZD\rChose drive to use:\u0026gt; 0\r选择标识的0网盘\nFound drive 'root' of type 'business', URL: https://kogfw***.sharepoint.com/personal/s1oz_****/Documents\rIs that okay?\ry) Yes (default)\rn) No\ry/n\u0026gt; y\r选择y\n--------------------\r[onedrive]\rtype = onedrive\rregion = global\rtoken = {\u0026quot;access_token\u0026quot;:\u0026quot;eyJ0eXAiLiIs**gU2l0ZXMuUmVhZC5BbGwgcHJvZmlsZSMastoKDtaM8uxbH-ypRGI0y8H_ysiRw20QRRLc7pdol6BmYo0BcRNXJgJN6xccP5b20-iyLejE_vF1Iw5AKQP4-qirH3NHP-S5l*********pLuC4BB4ohz64u3aY5OQn_T4Vh-Rr-ZaZD\rdrive_type = business\r--------------------\ry) Yes this is OK (default)\re) Edit this remote\rd) Delete this remote\ry/e/d\u0026gt; y\r显示相关config信息,提示你是否确认 输入y\nCurrent remotes:\rName Type\r==== ====\ronedrive onedrive\re) Edit existing remote\rn) New remote\rd) Delete remote\rr) Rename remote\rc) Copy remote\rs) Set configuration password\rq) Quit config\re/n/d/r/c/s/q\u0026gt; q\r按q退出配置界面 将刚显示的这段config信息粘贴到rclone插件中\n--------------------\r[onedrive]\rtype = onedrive\rregion = global\rtoken = {\u0026quot;access_token\u0026quot;:\u0026quot;eyJ0eXAiLiIs**gU2l0ZXMuUmVhZC5BbGwgcHJvZmlsZSMastoKDtaM8uxbH-ypRGI0y8H_ysiRw20QRRLc7pdol6BmYo0BcRNXJgJN6xccP5b20-iyLejE_vF1Iw5AKQP4-qirH3NHP-S5l*********pLuC4BB4ohz64u3aY5OQn_T4Vh-Rr-ZaZD\rdrive_type = business\r粘贴至Unraid设置-用户实用程序-rclcone\n然后在Unraid终端中输入\nrclone config\r即可看到已经连接的网盘信息\n创建用于挂载磁盘的目录 根据自己需求,新建一个用于挂载网盘的空文件夹\nmkdir -p /mnt/user/rclone/onedrive\r我想分的细一点,所以等下使用`onedrive空文件夹挂载刚刚连接的谷歌团队盘\n挂载网盘到本地 示例\nrclone mount onedrive:test /mnt/user/rclone/onedrive --umask 0000 --default-permissions --allow-non-empty --allow-other --buffer-size 32M --low-level-retries 200 --dir-cache-time 2h --vfs-read-chunk-size 64M --vfs-read-chunk-size-limit 1G \u0026amp;\r需要修改的就是 onedrive:test onedrive为网盘的名字不特指微软网盘test为要挂载的网盘文件夹路径,不填留为挂载整个网盘 /mnt/user/rclone/onedrive本地用于挂载的空目录 关于其他参数含义,可自行查阅最下方命令说明 如需要给emby之类使用,挂载文件夹不显示文件,请修改--umask 000 在emby终端输入 umask\n/ # umask\r0022\r/ # 将示例中--umask 000修改为--umask 0022 emby即可正常访问文件\n查询是否成功将网盘挂载到本地\ndf -h\r输入命令后,如成功挂载,就会有显示挂载的目录了\n开机自动挂载 可使用User Scripts插件新建开机任务,输入示例命令\n常用命令\nfusermount -qzu /mnt/user/rclone/onedrive\r按挂载的目录路径,卸载已挂载的网盘\nhttps://rclone.org/commands/\r官方的命令说明\n","permalink":"https://zynismus16.github.io/posts/106/","summary":"安装rclone插件 应用中搜索rclone 选择这个插件安装,其他两个为docker 安装完成后会出现在设置-用户实用程序中 连接网盘 微软网盘 因U","title":"Unraid上使用rclone插件挂载网盘"},{"content":"目前推测是因为视频色彩空间不同导致的,测试电脑对4:2:0色彩的视频能够生成缩略图但速度较慢,对4:2:2色彩的视频无法生成缩略图。 网上查找后发现安装 K-Lite Codec Pack 可解决。 安装完成后成功显示4:2:2色彩的缩略图,4:2:0的缩略图显示速度有明显提升。\n软件官网:Codec Guide: K-Lite Codec Pack - For Windows 11 / 10 / 8.1 / 7 分流下载:\n","permalink":"https://zynismus16.github.io/posts/103/","summary":"目前推测是因为视频色彩空间不同导致的,测试电脑对4:2:0色彩的视频能够生成缩略图但速度较慢,对4:2:2色彩的视频无法生成缩略图。 网上查找","title":"解决索尼相机拍摄素材在win10上无法显示缩略图的问题"},{"content":"先来一种最简单的方法,它直接在body属性定义了oncontextmenu,使得右键的值为false,起到了屏蔽右键的效果。\n\u0026lt;body oncontextmenu=self.event.returnValue=false\u0026gt; 复制\n这个方式虽然屏蔽掉了右键的功能,但是左键还可以使用,自然Ctrl+c,Ctrl+v的功能还是可以用的,这时需要屏蔽掉左键,可是要屏蔽左键不是就废掉了,别急,这里只是屏蔽掉左键的选定功能,代码如下:\n\u0026lt;body onselectstart=\u0026#34;return false\u0026#34;\u0026gt; 复制\n左右键联合起来,就彻底控制了左右键:\n\u0026lt;body oncontextmenu=self.event.returnValue=false onselectstart=\u0026#34;return false\u0026#34;\u0026gt; ","permalink":"https://zynismus16.github.io/posts/44/","summary":"先来一种最简单的方法,它直接在body属性定义了oncontextmenu,使得右键的值为false,起到了屏蔽右键的效果。 \u0026lt;body oncontextmenu=self.event.returnValue=false\u0026gt; 复制 这个方式","title":"网页禁用左右键"},{"content":"安装 下载 点击该链接下载 Office Tool Plus,或访问 Office Tool Plus 官网 下载压缩包。 下载完成后解压压缩包得到以下文件 双击打开 Office Tool Plus.exe 部署 点击左边部署 按下图配置\n添加产品 产品中点击右方添加产品 添加 Office 专业增强版 2021\n下方应用程序可按照需求选择,如只需要Word Excel PPT 就按照下图选择 开始部署 选择完成后点击页面最上方 开始部署 等待下载完成并部署完成 激活 部署完成后点击页面左方激活 许可证安装 选择许可证管理并点击安装许可证 选择 Office LTSC 专业增强版 2021 -批量许可证 界面最下方有安装进度,等待所有许可证安装完成。 KSM主机设置 安完成后选择上方 KSM管理 ,并在 KSM主机 栏填入KSM 主机地址:kms.loli.best 这里提供其他KSM主机列表,可选择其他主机地址: KMS 列表 | Yerong の小窝 (coolhub.top) 填入KSM主机地址后点击 设置主机\n最后点击激活并等待程序运行完成即可。 Tip: 如果输出区提示激活失败,红色字体提示许可证未安装时可尝试卸载许可证后重新安装类似产品的许可证。 ","permalink":"https://zynismus16.github.io/posts/27/","summary":"安装 下载 点击该链接下载 Office Tool Plus,或访问 Office Tool Plus 官网 下载压缩包。 下载完成后解压压缩包得到以下文件 双击打开 Office Tool Plus.exe 部署 点击左边部署 按下图配置 添加","title":"使用Office Tool Plus部署Ofiice 2021"},{"content":"Max界面与菜单栏讲解 基本工具 选择工具 快捷键:Q\nc tr l :加选 a l t :减选 有多种选择方式 交叉/窗口\n移动工具 快捷键:w\n轴向是可以锁定的,移动前请先确认选择的轴向\n旋转工具 快捷键:E\n外圈灰色进行旋转是于屏幕平行轴向进行旋转\n缩放工具 快捷键:R\n有三种缩放方式,除特殊情况不要使用第三种\n进阶工具 3D捕捉工具 用来进行点对点的对齐以及快速单轴向对\n角度捕捉工具 对于旋转角度进行固定数值旋转\n材质编辑器 节点材质编辑器和层级材质编辑器,给与模型真正的颜色显示\n对齐与镜像 对齐工具:补充无法进行点位吸附的一种对齐方式镜像:快速复制并且翻转模型,但是个人基本不用\n3DMAX软件常用快捷键 鼠标中键 平移运动\nAlt + 鼠标中键 旋转视图\nAlt + ctrl + 鼠标中键 视图的放大缩小\nCtrl + z 恢复上一步\nCtrl + y 重复上一步\nCtrl + a 全选\nCtrl + I 反选\nG 网格切换\nF 前视图\nT 顶视图\nL 左视图\nB 底视图\nAlt + W 最 大化显示视图\nCtrl + C 将摄相机适配到视图\nAlt + Q 将当前选择的物体隔离并最 大化显示在视图上, 其它物体暂时消失显示。\nC 将所选的视图转换为摄相机视图\nw 位移\ne 旋转\nr 放缩\nO 显示降级适配(开关)\nV 打开视图快捷键切换菜单,选择视图进行切换。\n+ 放大坐标轴\n- 缩小坐标轴\nCtrl + Atl + z 在当前视图完全显示所有物体\nz 在当前视图完全显示所选物体\nshift + 鼠标左键 复制所选择的一个或多个物体\nCtrl + 鼠标左键 增加选择\nAlt + 鼠标左键 减少选择\nH 菜单选择物体\nM 显示材质编辑器\nN 打开动画记录按钮\n/? 播放动画\nF3 实体显示和线框显示的切换\nF4 线框显示\nF9 快速渲染\nF10 显示渲染菜单 [ ] 分别放大或缩小一倍视图显示\nM 材质\nz 选择物最大\nctrl + AlT + z 满屏\nctrl + x 视图模式\nALT + W 最 大化\nShift + Q = 渲染\nF9 视图切换\nF3 显示降级适配(开关)\nO 适应透视图格点\nShift + Ctrl + A 排列\nAlt + A 角度捕捉(开关)\nA 动画模式 (开关)\nN 改变到后视图\nK 背景锁定(开关)\nAlt + Ctrl + B 前一时间单位\n. 下一时间单位\n, 改变到上(Top)视图\nT 改变到底(Bottom)视图\nB 改变到相机(Camera)视图\nC 改变到前(Front)视图\nF 改变到等大的用户(User)视图\nU 改变到右(Right)视图\nR 改变到透视(Perspective)图\nP 循环改变选择方式\nCtrl + F 默认灯光(开关)\nCtrl + L 删除物体\nDEL 当前视图暂时失效\nD 是否显示几何体内框(开关)\nCtrl + E 显示第 一个工具条\nAlt + 1 专家模式全屏(开关)\nCtrl + X 暂存(Hold)场景\nAlt + Ctrl + H 取回(Fetch)场景\nAlt + Ctrl + F 冻结所选物体\n6 跳到最 后一帧\nEND 跳到第 一帧\nHOME 显示/隐藏相机(Cameras)\nShift + C 显示/隐藏几何体(Geometry)\nShift + O 显示/隐藏网格(Grids)\nG 显示/隐藏帮助(Helpers)物体\nShift + H 显示/隐藏光源(Lights)\nShift + L 显示/隐藏粒子系统(Particle Systems)\nShift + P 显示/隐藏空间扭曲(Space Warps)物体\nShift + W 锁定用户界面(开关)\nAlt + 0 匹配到相机(Camera)视图\nCtrl + C 材质(Material)编辑器\nM 最 大化\n","permalink":"https://zynismus16.github.io/posts/10/","summary":"Max界面与菜单栏讲解 基本工具 选择工具 快捷键:Q c tr l :加选 a l t :减选 有多种选择方式 交叉/窗口 移动工具 快捷键:w 轴向是可以锁定的,移动前","title":"3D max入门学习 Part.1"},{"content":"在ADBlock插件设置中找到添加自定义屏蔽规则,添加下面代码即可屏蔽。\nstatic.zhihu.com/heifetz/main.signflow.*.js\rstatic.zhihu.com/heifetz/*.signflow.*.css ","permalink":"https://zynismus16.github.io/posts/11/","summary":"在ADBlock插件设置中找到添加自定义屏蔽规则,添加下面代码即可屏蔽。 static.zhihu.com/heifetz/main.signflow.*.js static.zhihu.com/heifetz/*.signflow.*.css","title":"使用ADBlock插件屏蔽知乎登录弹窗"},{"content":"Typecho数据库常用API,整理了Typecho数据库常用的API,实现基本的CURD操作。创建(Create)、更新(Update)、读取(Retrieve)和删除(Delete)\n表创建和删除 在Typecho插件开发过程中,往往需要创建自己的表。Typecho_Db类中的query函数,可用于执行所有sql语句,因此我们使用query()来进行表的创建、修改或者删除。\n$db= Typecho_Db::get();\r$prefix = $db-\u0026gt;getPrefix();\r$db-\u0026gt;query(\u0026#39;create table \u0026#39;.$prefix.\u0026#39;metas xxxxx\u0026#39;); 注意,使用query方式创建表的时候,需要在表明前手动添加$prefix前缀,否则在后面的使用过程中会造成困惑。\n还可以使用table.来代替$prefix,typecho会自动识别并替换成指定的前缀。\n同理,修改或者删除Typecho数据库中表,按照同样的方式调用query即可。\n数据查询 select,查询表数据 select语句是可以说Typecho插件开发中最常用的sql调用。\n$db = Typecho_Db::get();\r$query= $db-\u0026gt;select()-\u0026gt;from(\u0026#39;table.metas\u0026#39;);\r$result = $db-\u0026gt;fetchAll($query); 说明: typecho中,.号具有特定的意义,这里table.metas表示这是一个metas表。实际上,typecho是自动将table.的字符使用str_replace替换成了config.inc.php中设定的前缀。\n举例: $db-\u0026gt;select()-\u0026gt;from('table.metas');将生成SELECT * FROM typecho_metas WHERE (mid= '2' ),其中typecho_是表前缀; 而$db-\u0026gt;select()-\u0026gt;from('metas');将生成SELECT * FROM metas WHERE (mid= '2' ),注意这里没有了表前缀。 指定表字段查询\n有时为了提高查询性能,需要指定查询表中特定的几个字段,那么可以使用下面的方式:\n$query= $db-\u0026gt;select(\u0026#39;mid\u0026#39;,\u0026#39;name\u0026#39;)-\u0026gt;from(\u0026#39;table.metas\u0026#39;);\recho $query; //SELECT `mid` , `name` FROM typecho_metas 如果联合查询中,两个表存在相同的字段名,那么可以使用table.来指定表名:\n$query = $db-\u0026gt;select(\u0026#39;table.contents.cid\u0026#39;)-\u0026gt;from(\u0026#39;table.contents\u0026#39;)-\u0026gt;join.... 指定查询条件 指定SQL查询的where语句,是最常用的api调用。\n$query= $db-\u0026gt;select(\u0026#39;mid\u0026#39;,\u0026#39;name\u0026#39;)-\u0026gt;from(\u0026#39;table.metas\u0026#39;)-\u0026gt;where(\u0026#39;mid = ?\u0026#39;, 2);\recho $query; //SELECT * FROM typecho_metas WHERE (`mid` = \u0026#39;2\u0026#39; ) 如需要指定多个查询条件,直接多次调用where即可,将生成and关系的where条件\n$db-\u0026gt;select(\u0026#39;mid\u0026#39;,\u0026#39;name\u0026#39;)-\u0026gt;from(\u0026#39;table.metas\u0026#39;)-\u0026gt;where(\u0026#39;mid = ?\u0026#39;, 2)-\u0026gt;where(\u0026#39;name like ? \u0026#39;, $name); 使用OR关系的查询条件\n可以使用orWhere()函数来指定SQL查询的或条件。\n$db-\u0026gt;select(\u0026#39;mid\u0026#39;,\u0026#39;name\u0026#39;)-\u0026gt;from(\u0026#39;table.metas\u0026#39;)-\u0026gt;where(\u0026#39;mid = ?\u0026#39;, 2)-\u0026gt;orWhere(\u0026#39;mid = ? \u0026#39;, 3);\r//SELECT `mid` , `name` FROM typecho_metas WHERE (`mid` = \u0026#39;2\u0026#39; ) OR (`mid` = \u0026#39;3\u0026#39; ) 指定查询范围\n在需要分页的场景下,分页是必需的操作。offset()和limit()分别用于指定起始位置和结束位置,即指定查询范围。\n$query = $db-\u0026gt;select(\u0026#39;mid\u0026#39;,\u0026#39;name\u0026#39;)-\u0026gt;from(\u0026#39;table.metas\u0026#39;)-\u0026gt;offset(2)-\u0026gt;limit(3);\recho $query;//SELECT `mid` , `name` FROM typecho_metas LIMIT 3 OFFSET 2 Typecho中,还提供了一种简写的方法,见page()函数。\n$query = $db-\u0026gt;select(\u0026#39;mid\u0026#39;,\u0026#39;name\u0026#39;)-\u0026gt;from(\u0026#39;table.metas\u0026#39;)-\u0026gt;page(3,10);\recho $query;//SELECT `mid` , `name` FROM typecho_metas LIMIT 10 OFFSET 20\r//表示取第三页,并取10条记录。 对查询结果进行排序 在Typecho中,使用order()函数和Typecho_Db::SORT_DESC指定查询结果的排序方式。\n$query = $db-\u0026gt;select(\u0026#39;mid\u0026#39;,\u0026#39;name\u0026#39;)-\u0026gt;from(\u0026#39;table.metas\u0026#39;)-\u0026gt;order(\u0026#39;mid\u0026#39;,Typecho_Db::SORT_DESC);\recho $query;//SELECT `mid` , `name` FROM typecho_metas ORDER BY `mid` DESC Tips: Typecho_Db::SORT_ASC 表示升序排序,Typecho_Db::SORT_DESC表示降序排序\n联合查询 联合查询是SQL的常用语法,在Typecho中,同样使用内置函数join()方便地进行联合查询。\n$query = $db-\u0026gt;select()\r-\u0026gt;from(\u0026#39;table.contents\u0026#39;)\r-\u0026gt;join(\u0026#39;table.comments\u0026#39;, \u0026#39;table.contents.cid = table.comments.cid\u0026#39;,Typecho_Db::LEFT_JOIN)\r-\u0026gt;where(\u0026#39;table.contents.type = ?\u0026#39;, \u0026#39;post\u0026#39;);\recho $query;\r//SELECT * FROM typechocontents LEFT JOIN typecho_comments ON typecho_contents.`cid` = typecho_comments.`cid` WHERE (typecho_contents.`type` = \u0026#39;post\u0026#39; ) update,更新表数据 Typecho中,使用update()函数来进行更新表操作。但注意,update操作,需要借助于query执行。\n$update = $db-\u0026gt;update(\u0026#39;table.metas\u0026#39;)-\u0026gt;rows(array(\u0026#39;name\u0026#39;=\u0026gt;\u0026#39;case_in_cn\u0026#39;))-\u0026gt;where(\u0026#39;mid=?\u0026#39;,6);\recho $update;//UPDATE typecho_metas SET `name` = \u0026#39;some_name\u0026#39; WHERE (`mid`=\u0026#39;6\u0026#39; )\r//执行后,返回收影响的行数。\r$updateRows= $db-\u0026gt;query($update); insert,插入数据 Typecho中,使用insert()函数来进行表插入操作。同样,insert操作需要借助于query函数。\n$insert = $db-\u0026gt;insert(\u0026#39;table.metas\u0026#39;)\r-\u0026gt;rows(array(\u0026#39;mid\u0026#39; =\u0026gt; \u0026#39;22\u0026#39;, \u0026#39;name\u0026#39; =\u0026gt; \u0026#39;hello world\u0026#39;));\r//将构建好的sql执行, 如果你的主键id是自增型的还会返回insert id\r$insertId = $db-\u0026gt;query($insert); delete,删除数据 Typecho中使用delete()函数来删除数据表中的行。delete操作用于删除数据表中指定的行,同样需要借助query函数执行。\n$delete = $db-\u0026gt;delete(\u0026#39;table.metas\u0026#39;)\r-\u0026gt;where(\u0026#39;mid = ?\u0026#39;, 2);\r//将构建好的sql执行, 会自动返回已经删除的记录数\r$deletedRows = $db-\u0026gt;query($delete); 数据库调试\n查看查询语句 在Typecho调试过程中,打印sql语句往往是很有帮助的。对于大于5.2版本的php,直接echo $query即可,对于小于5.2版本,则需要显式调用__toString()函数\n$select = $db-\u0026gt;select()-\u0026gt;from(\u0026#39;table.metas\u0026#39;);\r//如果版本大于php5.2\recho $select;\r//如果小于php5.2\recho $select-\u0026gt;__toString(); ","permalink":"https://zynismus16.github.io/posts/12/","summary":"Typecho数据库常用API,整理了Typecho数据库常用的API,实现基本的CURD操作。创建(Create)、更新(Update)、","title":"Typecho数据库常用的API,创建/更新/读取/删除"},{"content":"将下面的代码放到 post.php 中即可\n\u0026lt;?php Typecho_Widget::widget(\u0026#39;Widget_Security\u0026#39;)-\u0026gt;to($security); ?\u0026gt;\r\u0026lt;a href=\u0026#34;\u0026lt;?php $security-\u0026gt;index(\u0026#39;/action/contents-post-edit?do=delete\u0026amp;cid=\u0026#39;.$this-\u0026gt;cid); ?\u0026gt;\u0026#34;\u0026gt;删除文章\u0026lt;/a\u0026gt; 点击按钮立即删除文章!\n上面的代码虽然实现了功能,但却泯灭了人性!下面我们完善下人性部分,代码改为\n\u0026lt;?php Typecho_Widget::widget(\u0026#39;Widget_Security\u0026#39;)-\u0026gt;to($security); ?\u0026gt;\r\u0026lt;a href=\u0026#34;\u0026lt;?php $security-\u0026gt;index(\u0026#39;/action/contents-post-edit?do=delete\u0026amp;cid=\u0026#39;.$this-\u0026gt;cid); ?\u0026gt;\u0026#34; onclick=\u0026#34;javascript:return p_del()\u0026#34;\u0026gt;删除文章\u0026lt;/a\u0026gt;\r\u0026lt;script\u0026gt;\rfunction p_del() {\rvar msg = \u0026#34;您真的确定要删除吗?\u0026#34;;\rif (confirm(msg)==true){\rreturn true;\r}else{\rreturn false;\r}\r}\r\u0026lt;/script\u0026gt; 这样弄好,点击按钮会弹出确认框,问其是否删除文章,用户确认后才会删除,比较符合操作习惯!\npost.php 页面成功删除文章后,因为文章不存在了,所以页面自动跳到了 404 页面\n","permalink":"https://zynismus16.github.io/posts/13/","summary":"将下面的代码放到 post.php 中即可 \u0026lt;?php Typecho_Widget::widget(\u0026#39;Widget_Security\u0026#39;)-\u0026gt;to($security); ?\u0026gt; \u0026lt;a href=\u0026#34;\u0026lt;?php $security-\u0026gt;index(\u0026#39;/action/contents-post-edit?do=delete\u0026amp;cid=\u0026#39;.$this-\u0026gt;cid); ?\u0026gt;\u0026#34;\u0026gt;删除文章\u0026lt;/a\u0026gt; 点击按钮立即删除文章! 上面的代码虽然实现了功能,","title":"Typecho主题前台实现删除文章功能"},{"content":"typecho的author.php文件\n是用户页面,但是官网给予的参考文档很少,很多人也是直接忽略掉了这个页面\n我也是通过打印$this\n获取了我们大概能调用,有用的东西\n例如:获取当前用户的信息\n$userInfo = (object)$this-\u0026gt;pageRow;\rprint_r($userInfo-\u0026gt;screenName); 具体可调用参数,可打印print_r($userInfo)来查看\n输出该作者的文章,这里跟列表页面一样的\n至于为什么?\narchive.php 通用(分类、搜索、标签、作者)页面文件\n可以看结构,这四个页面能调用的东西都大致相同\n\u0026lt;?php if ($this-\u0026gt;have()): ?\u0026gt;\r\u0026lt;?php while($this-\u0026gt;next()): ?\u0026gt;\r内容\r\u0026lt;?php endwhile; ?\u0026gt;\r\u0026lt;?php else: ?\u0026gt;\r\u0026lt;article class=\u0026#34;article-post\u0026#34;\u0026gt;\r\u0026lt;div class=\u0026#34;content-null\u0026#34;\u0026gt;\r\u0026lt;p\u0026gt;空空如也~\u0026lt;/p\u0026gt;\r\u0026lt;/div\u0026gt;\r\u0026lt;/article\u0026gt;\r\u0026lt;?php endif; ?\u0026gt; 输出这个人的评论\n需要在 functions.php 添加代码\n/*输出作者发表的评论*/\rclass Widget_Post_AuthorComment extends Widget_Abstract_Comments\r{\rvar $getAuthorUid;\rpublic function execute()\r{\rglobal $AuthorCommentId;//全局作者id\r$select = $this-\u0026gt;select()-\u0026gt;limit($this-\u0026gt;parameter-\u0026gt;pageSize)\r-\u0026gt;where(\u0026#39;table.comments.status = ?\u0026#39;, \u0026#39;approved\u0026#39;)\r-\u0026gt;where(\u0026#39;table.comments.authorId = ?\u0026#39;,$this-\u0026gt;parameter-\u0026gt;authorId)//获取作者id\r-\u0026gt;where(\u0026#39;table.comments.type = ?\u0026#39;, \u0026#39;comment\u0026#39;)\r-\u0026gt;order(\u0026#39;table.comments.coid\u0026#39;, Typecho_Db::SORT_DESC);//根据coid排序\r$this-\u0026gt;db-\u0026gt;fetchAll($select, array($this, \u0026#39;push\u0026#39;));\r}\r} 然后再 author.php 可以调用\n\u0026lt;?php $this-\u0026gt;widget(\u0026#39;Widget_Post_AuthorComment@author\u0026#39;,\u0026#39;pageSize=8\u0026amp;authorId=用户id\u0026#39;)-\u0026gt;to($AuthorComment); ?\u0026gt;\r\u0026lt;?php if ($AuthorComment-\u0026gt;have()): ?\u0026gt;\r\u0026lt;?php while($AuthorComment-\u0026gt;next()): ?\u0026gt;\r//循环处\r//可调用参数\r//$AuthorComment-\u0026gt;permalink(); 该评论所属文章链接\r//$AuthorComment-\u0026gt;title();该评论所属文章标题\r//$AuthorComment-\u0026gt;content();该评论内容\r//$AuthorComment-\u0026gt;dateWord();该评论时间\r\u0026lt;?php endwhile; ?\u0026gt;\r\u0026lt;?php else: ?\u0026gt;\r\u0026lt;div class=\u0026#34;text-center\u0026#34;\u0026gt;\u0026lt;div class=\u0026#34;icon-svg svg-empty\u0026#34;\u0026gt;\u0026lt;/div\u0026gt;\u0026lt;div class=\u0026#34;text-muted\u0026#34;\u0026gt;看起来这里没有任何东西。\u0026lt;/div\u0026gt;\u0026lt;/div\u0026gt;\r\u0026lt;?php endif; ?\u0026gt; ","permalink":"https://zynismus16.github.io/posts/14/","summary":"typecho的author.php文件 是用户页面,但是官网给予的参考文档很少,很多人也是直接忽略掉了这个页面 我也是通过打印$this 获取了","title":"author.php打造用户中心社区的参数调用和使用方法"},{"content":"Typecho常用函数:\n1、网站名称\n\u0026lt;?php $this-\u0026gt;options-\u0026gt;title() ?\u0026gt; 2、网站网址\n\u0026lt;?php $this-\u0026gt;options -\u0026gt;siteUrl(); ?\u0026gt; 3、站点说明\n\u0026lt;?php $this-\u0026gt;options-\u0026gt;description() ?\u0026gt; 4、文章完整路径和标题\n\u0026lt;?php $this-\u0026gt;archiveTitle(\u0026#39; \u0026amp;raquo; \u0026#39;, \u0026lt; span class=\u0026#34;string\u0026#34;\u0026gt;\u0026#39;\u0026#39;, \u0026#39; | \u0026#39;); ?\u0026gt;\u0026lt;?php $this -\u0026gt;options-\u0026gt;title(); ?\u0026gt; 5、模板地址\n\u0026lt;?php $this-\u0026gt;options-\u0026gt;themeUrl(); ?\u0026gt; 6、导入模板文件夹内的php文件\n\u0026lt;?php $this-\u0026gt;need(\u0026#39;.php\u0026#39;); ?\u0026gt; 7、输出文章或单页面的作者\n\u0026lt;?php $this-\u0026gt;author(); ?\u0026gt; 8、输出作者gravatar头像\n//此处是输出完整的 img 标签,40 是头像的宽高\r\u0026lt; ?php $this-\u0026gt;author-\u0026gt;gravatar(\u0026#39;40\u0026#39;) ?\u0026gt; 9、作者文章列表链接\n//Typecho支持多用户博客时,按作者获取该作者文章连接\r\u0026lt;?php $this-\u0026gt;author-\u0026gt;permalink (); ?\u0026gt; 10、作者个人主页链接\n//Typecho 支持多用户博客,此处输出作者个人主页地址\r\u0026lt;?php $this-\u0026gt;author-\u0026gt;url(); ?\u0026gt; 11 、作者的邮箱地址\n\u0026lt;?php $this-\u0026gt;author-\u0026gt;mail(); ?\u0026gt; 12、上一篇与下一篇调用代码\n// 上一篇\r\u0026lt;?php $this-\u0026gt;thePrev(); ?\u0026gt;\r// 下一篇\r\u0026lt;?php $this-\u0026gt;theNext(); ?\u0026gt; 13、typecho中is语法是否为首页并输出相关内容\n\u0026lt;?php if ($this-\u0026gt;is(\u0026#39;index\u0026#39;)): ?\u0026gt;\r// 首页输出内容\r\u0026lt;?php elseif ($this-\u0026gt;is(\u0026#39;category\u0026#39;)): ?\u0026gt;\r// 按照分类输出内容\r\u0026lt;?php else: ?\u0026gt;\r// 不是首页、分类输出内容\r\u0026lt;?php endif; ?\u0026gt; 14、获取文章或页面评论数\n\u0026lt;?php $this-\u0026gt;commentsNum(\u0026#39;No Comments\u0026#39;, \u0026#39;1 Comment\u0026#39; , \u0026#39;%d Comments\u0026#39;); ?\u0026gt; 15、截取文章指定字数(可用于首页显示文章摘要)\n// 截取350字并以\u0026#34;...\u0026#34;结尾\r\u0026lt;?php $this-\u0026gt;excerpt(350, \u0026#39;...\u0026#39;); ?\u0026gt; 16、调用自定义字段\n\u0026lt;?php $this-\u0026gt;fields-\u0026gt;fieldName ?\u0026gt; 17、获取 RSS 地址\n\u0026lt;?php $this-\u0026gt;options-\u0026gt;feedUrl(); ?\u0026gt; 18、获取最新文章\n\u0026lt;?php $this-\u0026gt;widget(\u0026#39;Widget_Contents_Post_Recent\u0026#39;, \u0026#39;pageSize=8\u0026amp;type=category\u0026#39;)-\u0026gt;parse(\u0026#39;\u0026lt;li\u0026gt;\u0026lt;a href=\u0026#34;{permalink}\u0026#34;\u0026gt;{title}\u0026lt;/a\u0026gt;\u0026lt;/li\u0026gt;\u0026#39;); ?\u0026gt; 19、获取分类名称,不带链接\n// 不带连接的获取分类\r\u0026lt;?php $this-\u0026gt;category(\u0026#39;,\u0026#39;, false); ?\u0026gt;\r// 获取所有分类\r\u0026lt;?php $this-\u0026gt;widget(\u0026#39;Widget_Metas_Category_List\u0026#39;)-\u0026gt;listCategories(\u0026#39;wrapClass=widget-list\u0026#39;); ?\u0026gt;\r// 自定义分类\r\u0026lt;?php $category = NULL; $this-\u0026gt;widget(\u0026#39;Widget_Metas_Category_List\u0026#39;)-\u0026gt;to($category); ?\u0026gt;\r\u0026lt;?php while ($category-\u0026gt;next()): ?\u0026gt;\r\u0026lt;a class=\u0026#34;list-group-item list-group-item-action\u0026#34; title=\u0026#34;\u0026lt;?php $category-\u0026gt;description(); ?\u0026gt;\u0026#34; href=\u0026#34;\u0026lt;?php $category-\u0026gt;permalink(); ?\u0026gt;\u0026#34;\u0026gt;\u0026lt;?php $category-\u0026gt;name(); ?\u0026gt;\u0026lt;/a\u0026gt;\r\u0026lt;?php endwhile; ?\u0026gt; 20、获取文章分类列表\n\u0026lt;?php $this-\u0026gt;widget(\u0026#39;Widget_Metas_Category_List\u0026#39;)-\u0026gt;parse(\u0026#39;\u0026lt;li\u0026gt;\u0026lt;a href=\u0026#34;{permalink}\u0026#34;\u0026gt;{name}\u0026lt;/a\u0026gt; ({count})\u0026lt;/li\u0026gt;\u0026#39;); ?\u0026gt; 21、获取某分类下的POST文章\n// 注意参数 mid=1\r\u0026lt;?php $this-\u0026gt;widget(\u0026#39;Widget_Archive@index\u0026#39;, \u0026#39;pageSize=8\u0026amp;type=category\u0026#39;, \u0026#39;mid=1\u0026#39;)\r-\u0026gt;parse(\u0026#39;\u0026lt;li\u0026gt;\u0026lt;a href=\u0026#34;{permalink}\u0026#34; title=\u0026#34;{title}\u0026#34;\u0026gt;{title}\u0026lt;/a\u0026gt;\u0026lt;/li\u0026gt;\u0026#39;); ?\u0026gt; 22、获取最新评论列表\n\u0026lt;?php $this-\u0026gt;widget(\u0026#39;Widget_Comments_Recent\u0026#39;)-\u0026gt;to($comments); ?\u0026gt;\r\u0026lt;?php while($comments-\u0026gt;next()): ?\u0026gt;\r\u0026lt;li\u0026gt;\r\u0026lt;a href=\u0026#34;\u0026lt;?php $comments-\u0026gt;permalink(); ?\u0026gt;\u0026#34;\u0026gt;\r\u0026lt;?php $comments-\u0026gt;author(false); ?\u0026gt;\r\u0026lt;/a\u0026gt;: \u0026lt;?php $comments-\u0026gt;excerpt(50, \u0026#39;...\u0026#39;); ?\u0026gt;\r\u0026lt;/li\u0026gt;\r\u0026lt;?php endwhile; ?\u0026gt; 23、首页获取限制条数的最新文章(可用于置顶操作类)\n\u0026lt;?php while ($this-\u0026gt;next()): ?\u0026gt;\r\u0026lt;?php if ($this-\u0026gt;sequence \u0026lt;= 3): ?\u0026gt;\r//这里编写html逻辑\r\u0026lt;?php endif; ?\u0026gt;\r\u0026lt;?php endwhile; ?\u0026gt; 24、获取访客最新评论,只显示访客评论不显示博主自己发的评论\n\u0026lt;?php $this-\u0026gt;widget(\u0026#39;Widget_Comments_Recent\u0026#39;,\u0026#39;ignoreAuthor=true\u0026#39;)-\u0026gt;to($comments); ?\u0026gt;\r\u0026lt;?php while($comments-\u0026gt;next()): ?\u0026gt;\r\u0026lt;li\u0026gt;\u0026lt;a href=\u0026#34;\u0026lt;?php $comments-\u0026gt;permalink(); ?\u0026gt;\u0026#34;\u0026gt;\u0026lt;?php $comments-\u0026gt;author(false); ?\u0026gt;\u0026lt;/a\u0026gt;: \u0026lt;?php $comments-\u0026gt;excerpt(50, \u0026#39;...\u0026#39;); ?\u0026gt;\u0026lt;/li\u0026gt;\r\u0026lt;?php endwhile; ?\u0026gt; 25、文章按时间归档\n\u0026lt;?php\r$this-\u0026gt;widget(\u0026#39;Widget_Contents_Post_Date\u0026#39;, \u0026#39;type=month\u0026amp;format=F Y\u0026#39;)-\u0026gt;parse(\u0026#39;\u0026lt;li\u0026gt;\u0026lt;a href=\u0026#34;{permalink}\u0026#34;\u0026gt;{date}\u0026lt;/a\u0026gt;\u0026lt;/li\u0026gt;\u0026#39;);\r?\u0026gt; 26、获取标签云\n// 输出标签云\r\u0026lt;?php $this-\u0026gt;widget(\u0026#39;Widget_Metas_Tag_Cloud\u0026#39;, \u0026#39;sort=mid\u0026amp;ignoreZeroCount=1\u0026amp;desc=0\u0026amp;limit=30\u0026#39;)-\u0026gt;to($tags); ?\u0026gt;\r\u0026lt;?php if($tags-\u0026gt;have()): ?\u0026gt;\r\u0026lt;ul class=\u0026#34;tags-list\u0026#34;\u0026gt;\r\u0026lt;?php while ($tags-\u0026gt;next()): ?\u0026gt;\r\u0026lt;li\u0026gt;\u0026lt;a href=\u0026#34;\u0026lt;?php $tags-\u0026gt;permalink(); ?\u0026gt;\u0026#34; rel=\u0026#34;tag\u0026#34; class=\u0026#34;size-\u0026lt;?php $tags-\u0026gt;split(5, 10, 20, 30); ?\u0026gt;\u0026#34; title=\u0026#34;\u0026lt;?php $tags-\u0026gt;count(); ?\u0026gt; 个话题\u0026#34;\u0026gt;\u0026lt;?php $tags-\u0026gt;name(); ?\u0026gt;\u0026lt;/a\u0026gt;\u0026lt;/li\u0026gt;\r\u0026lt;?php endwhile; ?\u0026gt;\r\u0026lt;?php else: ?\u0026gt;\r\u0026lt;li\u0026gt;\u0026lt;?php _e(\u0026#39;没有任何标签\u0026#39;); ?\u0026gt;\u0026lt;/li\u0026gt;\r\u0026lt;?php endif; ?\u0026gt;\r\u0026lt;/ul\u0026gt;\r// 输出随机颜色标签云\r\u0026lt;?php $this-\u0026gt;widget(\u0026#39;Widget_Metas_Tag_Cloud\u0026#39;, \u0026#39;ignoreZeroCount=1\u0026amp;limit=30\u0026#39;)-\u0026gt;to($tags); ?\u0026gt;\r\u0026lt;ul class=\u0026#34;tags-list\u0026#34;\u0026gt;\r\u0026lt;?php while($tags-\u0026gt;next()): ?\u0026gt;\r\u0026lt;li\u0026gt;\u0026lt;a style=\u0026#34;color: rgb(\u0026lt;?php echo(rand(0, 255)); ?\u0026gt;, \u0026lt;?php echo(rand(0,255)); ?\u0026gt;, \u0026lt;?php echo(rand(0, 255)); ?\u0026gt;)\u0026#34; href=\u0026#34;\u0026lt;?php $tags-\u0026gt;permalink(); ?\u0026gt;\u0026#34; title=\u0026#39;\u0026lt;?php $tags-\u0026gt;name(); ?\u0026gt;\u0026#39;\u0026gt;\u0026lt;?php $tags-\u0026gt;name(); ?\u0026gt;\u0026lt;/a\u0026gt;\u0026lt;/li\u0026gt;\r\u0026lt;?php endwhile; ?\u0026gt;\r\u0026lt;/ul\u0026gt; ","permalink":"https://zynismus16.github.io/posts/16/","summary":"Typecho常用函数: 1、网站名称 \u0026lt;?php $this-\u0026gt;options-\u0026gt;title() ?\u0026gt; 2、网站网址 \u0026lt;?php $this-\u0026gt;options -\u0026gt;siteUrl(); ?\u0026gt; 3、站点说明 \u0026lt;?php $this-\u0026gt;options-\u0026gt;description() ?\u0026gt; 4、文章完整路径和标题 \u0026lt;?php $this-\u0026gt;archiveTitle(\u0026#39; \u0026amp;raquo; \u0026#39;, \u0026lt; span class=\u0026#34;string\u0026#34;\u0026gt;\u0026#39;\u0026#39;, \u0026#39; | \u0026#39;); ?\u0026gt;\u0026lt;?php $this -\u0026gt;options-\u0026gt;title(); ?\u0026gt; 5、模板地","title":"Typecho常用函数"},{"content":" 打开电脑浏览器新建一个无痕页面访问网址 https://m.jd.com/ 按键盘F12键打开开发者工具,然后点下图中的图标,切换到触屏版界面浏览! 此时是未登录状态(建议使用手机短信验证码登录),如已登录请忽略此步骤 使用手机短信验证码登录(此方式cookie有效时长大概31天,其他登录方式比较短)\n点击网页右下角未登录按钮登录手机号。\n右边的开发者窗口选择箭头标识的Network或者网络窗口,没有的点击箭头指向的→符号选择。\n此时如果需要输入手势验证码请多试几次,由于鼠标操作没有触摸方便,容易识别失败。 登录成功\n获取cookie 现在看向开发者工具栏,下面会有很多链接,这时可以先点击红框1清除\n然后点击左侧网页中的右下角 我的\n这时右侧应该会多出来几个链接,如上图\n选择红框中有 log那个链接\n在弹出来的窗口下翻,一直翻到箭头所指的内容 cookie开头的\n复制整个段落即可\nps:可直接将该段粘贴到 http://nas.cxynas.top:5701/#/login\n然后点击登录即可畅享京东挂机自动签到做活动\n","permalink":"https://zynismus16.github.io/posts/17/","summary":"打开电脑浏览器新建一个无痕页面访问网址 https://m.jd.com/ 按键盘F12键打开开发者工具,然后点下图中的图标,切换到触屏版界面浏览! 此时是未登录状态(建议使用手","title":"PC浏览器获取京东Cookie教程"},{"content":"This article offers a sample of basic Markdown syntax that can be used in Hugo content files, also it shows whether basic HTML elements are decorated with CSS in a Hugo theme.\nHeadings The following HTML \u0026lt;h1\u0026gt;—\u0026lt;h6\u0026gt; elements represent six levels of section headings. \u0026lt;h1\u0026gt; is the highest section level while \u0026lt;h6\u0026gt; is the lowest.\nH1 H2 H3 H4 H5 H6 Paragraph Xerum, quo qui aut unt expliquam qui dolut labo. Aque venitatiusda cum, voluptionse latur sitiae dolessi aut parist aut dollo enim qui voluptate ma dolestendit peritin re plis aut quas inctum laceat est volestemque commosa as cus endigna tectur, offic to cor sequas etum rerum idem sintibus eiur? Quianimin porecus evelectur, cum que nis nust voloribus ratem aut omnimi, sitatur? Quiatem. Nam, omnis sum am facea corem alique molestrunt et eos evelece arcillit ut aut eos eos nus, sin conecerem erum fuga. Ri oditatquam, ad quibus unda veliamenimin cusam et facea ipsamus es exerum sitate dolores editium rerore eost, temped molorro ratiae volorro te reribus dolorer sperchicium faceata tiustia prat.\nItatur? Quiatae cullecum rem ent aut odis in re eossequodi nonsequ idebis ne sapicia is sinveli squiatum, core et que aut hariosam ex eat.\nBlockquotes The blockquote element represents content that is quoted from another source, optionally with a citation which must be within a footer or cite element, and optionally with in-line changes such as annotations and abbreviations.\nBlockquote without attribution Tiam, ad mint andaepu dandae nostion secatur sequo quae. Note that you can use Markdown syntax within a blockquote.\nBlockquote with attribution Don\u0026rsquo;t communicate by sharing memory, share memory by communicating.\n— Rob Pike1\nTables Tables aren\u0026rsquo;t part of the core Markdown spec, but Hugo supports them out-of-the-box.\nName Age Bob 27 Alice 23 Inline Markdown within tables Italics Bold Code italics bold code Code Blocks Inline Code This is Inline Code\nOnly pre This is pre text Code block with backticks \u0026lt;!DOCTYPE html\u0026gt; \u0026lt;html lang=\u0026#34;en\u0026#34;\u0026gt; \u0026lt;head\u0026gt; \u0026lt;meta charset=\u0026#34;utf-8\u0026#34; /\u0026gt; \u0026lt;title\u0026gt;Example HTML5 Document\u0026lt;/title\u0026gt; \u0026lt;/head\u0026gt; \u0026lt;body\u0026gt; \u0026lt;p\u0026gt;Test\u0026lt;/p\u0026gt; \u0026lt;/body\u0026gt; \u0026lt;/html\u0026gt; Code block with backticks and language specified 1 2 3 4 5 6 7 8 9 10 11 \u0026lt;!DOCTYPE html\u0026gt; \u0026lt;html lang=\u0026#34;en\u0026#34;\u0026gt; \u0026lt;head\u0026gt; \u0026lt;meta charset=\u0026#34;utf-8\u0026#34; /\u0026gt; \u0026lt;title\u0026gt;Example HTML5 Document\u0026lt;/title\u0026gt; \u0026lt;meta name=\u0026#34;description\u0026#34; content=\u0026#34;Sample article showcasing basic Markdown syntax and formatting for HTML elements.\u0026#34;\u0026gt; \u0026lt;/head\u0026gt; \u0026lt;body\u0026gt; \u0026lt;p\u0026gt;Test\u0026lt;/p\u0026gt; \u0026lt;/body\u0026gt; \u0026lt;/html\u0026gt; Code block indented with four spaces \u0026lt;!doctype html\u0026gt; \u0026lt;html lang=\u0026quot;en\u0026quot;\u0026gt; \u0026lt;head\u0026gt; \u0026lt;meta charset=\u0026quot;utf-8\u0026quot;\u0026gt; \u0026lt;title\u0026gt;Example HTML5 Document\u0026lt;/title\u0026gt; \u0026lt;/head\u0026gt; \u0026lt;body\u0026gt; \u0026lt;p\u0026gt;Test\u0026lt;/p\u0026gt; \u0026lt;/body\u0026gt; \u0026lt;/html\u0026gt; Code block with Hugo\u0026rsquo;s internal highlight shortcode \u0026lt;!doctype html\u0026gt; \u0026lt;html lang=\u0026#34;en\u0026#34;\u0026gt; \u0026lt;head\u0026gt; \u0026lt;meta charset=\u0026#34;utf-8\u0026#34;\u0026gt; \u0026lt;title\u0026gt;Example HTML5 Document\u0026lt;/title\u0026gt; \u0026lt;/head\u0026gt; \u0026lt;body\u0026gt; \u0026lt;p\u0026gt;Test\u0026lt;/p\u0026gt; \u0026lt;/body\u0026gt; \u0026lt;/html\u0026gt; Gist List Types Ordered List First item Second item Third item Unordered List List item Another item And another item Nested list Fruit Apple Orange Banana Dairy Milk Cheese Other Elements — abbr, sub, sup, kbd, mark GIF is a bitmap image format.\nH2O\nXn + Yn = Zn\nPress CTRL+ALT+Delete to end the session.\nMost salamanders are nocturnal, and hunt for insects, worms, and other small creatures.\nThe above quote is excerpted from Rob Pike\u0026rsquo;s talk during Gopherfest, November 18, 2015.\u0026#160;\u0026#x21a9;\u0026#xfe0e;\n","permalink":"https://zynismus16.github.io/posts/50/","summary":"\u003cp\u003eThis article offers a sample of basic Markdown syntax that can be used in Hugo content files, also it shows whether basic HTML elements are decorated with CSS in a Hugo theme.\u003c/p\u003e","title":"markdown语法测试"},{"content":"\u0026amp;#32; 普通的英文半角空格\n\u0026amp;#160; \u0026amp;nbsp; \u0026amp;#xA0; no-break space 普通的英文半角空格但不换行\n\u0026amp;#12288; 中文全角空格 (一个中文宽度)\n\u0026amp;#8194; \u0026amp;ensp; en空格 半个中文宽度\n\u0026amp;#8195; \u0026amp;emsp; em空格 一个中文宽度\n\u0026amp;#8197; 四分之一em空格 (四分之一中文宽度)\n","permalink":"https://zynismus16.github.io/posts/19/","summary":"\u0026amp;#32; 普通的英文半角空格 \u0026amp;#160; \u0026amp;nbsp; \u0026amp;#xA0; no-break space 普通的英文半角空格但不换行 \u0026amp;#12288; 中文全角空格 (一个中文宽度) \u0026amp;#8194; \u0026amp;ensp; en空格 半个中文宽度 \u0026amp;#8195; \u0026amp;emsp; em空格 一个中文宽度 \u0026amp;#8197; 四分","title":"HTML占位符"},{"content":" 购买订阅 购买ssr订阅或V2ray订阅。 推荐使用Wallless机场 或者一元机场。 Wallless优惠码:\n9折优惠码: wallless2023 8折优惠码限年付: hey2023 下载安装 V2rayNG\n加速下载 官方下载 Google商店 设置订阅\n复制订阅地址 添加 V2ray 订阅 打开 V2rayNG, 点击左上角三道杠 【☰】 → 点击 订【阅分组设置】 → 点击右上角 【➕】。填写一个名称,把 v2ray 订阅添加进去,点右上角保存图标 【✔】-\u0026gt;退出订阅分组设置。 修改 V2rayNG 代理模式 更新 V2rayNG 订阅 在后期使用过程中,遇到多个节点不可用,请更新下订阅 更新时记得先关闭 vpn。如果更新订阅失败,尝试断开 vpn 连接后再更新。\n开启 V2rayNG 代理 上一步更新订阅成功后,在刷新出来的节点服务器中选择一个,点击右下角图标开启代理,首次开启弹出连接请求点击确定。 启动后即可访问 youtube,google 等服务测试网络连通性。如果感觉网速不佳,尝试切换不同节点,或者升级订阅套餐。\n","permalink":"https://zynismus16.github.io/posts/6/","summary":"购买订阅 购买ssr订阅或V2ray订阅。 推荐使用Wallless机场 或者一元机场。 Wallless优惠码: 9折优惠码: wallless2023 8折优惠码限年付: hey2023","title":"v2rayNG使用教程"},{"content":"官方描述 灵魂拷问,你为图床问题烦恼过吗?\n用 Hexo、VuePress、Hugo 等静态博客写文章,不知图片保存到哪里去\u0026hellip; 特意花钱租云服务器托管图片,太贵划不来,而且上传配置好繁琐\u0026hellip; 网上复制的心仪图片的链接,用着用着某一天就失效了\u0026hellip; 使用其他的付费图床,速度慢,容量小,还限时、限流量\u0026hellip; 想找一款真正免费、稳定、不限容量、访问速度还很快的图床\u0026hellip; \u0026hellip;\u0026hellip; 那么,快来试试 PicX 图床 吧,专为技术博主打造,谁用谁知道~\n只需选择一个 GitHub 仓库作为图床,然后在 PicX 官网 完成 Token 绑定和相应配置就能使用了。\nPicX 图床 浏览器在线使用,免下载\u0026amp;安装,如此简单。\n功能特性 支持 拖拽、复制粘贴、选择文件 等方式进行选择图片 支持图片 重命名、哈希化(确保图片名唯一)和 设置命名前缀 支持 批量上传图片、批量删除图片 和 批量复制图片外链 支持 多级目录 管理 (创建多级目录 / 查看多级目录图片) 支持 一键复制 图片外链和 一键转换 Markdown 格式 支持 图床管理(对仓库图片的 增删改查) 支持 图片压缩 (内置三款压缩算法,可在上传前自动压缩,效果极佳) 支持 暗夜模式 (自由切换 / 自动切换) 支持 PWA i18n 设置图片水印 支持其他 Git 厂商 (例如:Gitee / Coding)\n该图床可以自己搭建或者直接使用官方搭建好的,只需要使用自己的Github账户创建一个仓库,并创建一个能够访问仓库的Token。 及其简单,适合小白使用\n官方文档:https://picx-docs.xpoet.cn/tutorial/get-start.html 官方提供的图床:https://picx.xpoet.cn\n预览 ","permalink":"https://zynismus16.github.io/posts/20/","summary":"官方描述 灵魂拷问,你为图床问题烦恼过吗? 用 Hexo、VuePress、Hugo 等静态博客写文章,不知图片保存到哪里去\u0026hellip; 特意花钱","title":"PicX 一款以Github为存储的图床程序"},{"content":"FolderMagic 简单易用,无需部署的列表程序。 特性:\n无需环境,无需数据库,低内存占用 支持webdav管理 支持视频在线播放,支持字幕(srt, ass, ssa, vtt等) 支持图片预览,支持常见jpg, gif, png, tif, psd格式预览 支持音频在线播放,支持解析专辑图片和歌手信息 支持文档在线预览,包括常见各类代码格式,如html, js, css, php, py, pdf等 支持office在线预览 支持共享链接,支持共享链接管理 集成aria2ng,并安全的指向内部转发地址 文件搜索,即时搜索整个列表文件夹 中英多语言支持 支持常用文件管理,文件一拖即传 支持主流浏览器,完整支持IE11,部分支持IE10和IE9 响应式布局,适配移动浏览器,适配黑暗模式 这不是一个Onedrive/GoogleDrive/Dropbox/世纪互联/OSS 的列表程序,这是硬盘目录列表程序\n使用方式 本程序为linux amd64可执行文件 下载 https://github.com/FolderMagic/FolderMagic/raw/master/FolderMagic\nchmod +x FolderMagic 给权限 ./FolderMagic (其他自定义参数,参考github说明) (可选)用宝塔/apache/nginx/caddy等反代 默认共享当前所在文件夹,公开访问无认证。所有可选参数如下:\n命令行参数 -aria string\rAria2 RPC地址 (默认 \u0026#34;http://127.0.0.1:6800/jsonrpc\u0026#34;),列表程序将安全的转发这个地址\r-auth string\r认证: \u0026#34;用户名:密码\u0026#34; 认证信息用于网页登录和webdav,不设置则无认证,webdav将被禁用\r-bind string\r监听端口 (默认 \u0026#34;:80\u0026#34;)\r-gzip\r使用gzip压缩 (默认 true)\r-page404 string\r自定义404页面\r-root string\r列表根目录 (默认为当前目录)\r-share int\r默认共享链接有效期,单位分钟 (默认 60)\r-wd string\r用于webdav的认证路径, 不可使用根目录 (默认 \u0026#34;/manager\u0026#34;) 缩略图 webdav 使用 使用命令行 -auth user:password 启用鉴权后webdav即自动启用。\n使用raidrive或其他webdav兼容客户端连接 http://your.domain:port/manager 输入用户名和密码即可连接。\n/manager 可使用 -wd 指令更改\n文件管理 在网页列表界面右键即可操作文件和文件夹,可以新建和删除。\n不使用认证时只能下载文件,不能进行其他操作\n文件上传 使用webdav客户端上传。 直接把文件拖到列表界面,出现蓝框提示松手上传即可。 上传过程中可继续拖入新的文件排队上传。不支持拖文件夹上传。\nIE9 及以下浏览器由于浏览器限制无法上传。\n视频预览 支持预览mp4, mkv格式,能否成功播放取决于实际视频容器内的编码格式。\n字幕需要在视频同一文件夹下,字幕文件名包含视频名称即可,如a.mp4和a_en.srt即为匹配字幕。多个字幕将被同时载入可以在播放界面选择。字幕支持所有常见字幕,ass特效字幕保留文字部分,特效无法支持。\n音频预览 支持mp3和ogg,具体支持视浏览器而定。点击即可在左下角开始播放。\n音频将被自动解析专辑图片和歌曲名称,歌手。(IE9不支持解析)\n点击新的音频可以自动加入播放列表,切换文件夹不影响播放。 (IE9 将中断播放)\n图片预览 支持各种常见图片预览,图片将自动生成合适缩略图并使用webp格式(如果浏览器支持)传输\n支持psd格式预览,gif格式生成缩略图后没有动画。\nOffice预览 基于微软在线预览实现。按照微软的预览要求,需要将拥有域名并且FolderMagic需要在80或443端口,否则无法预览。\n即:浏览器中显示的地址必须为 http://example.com/example.doc 或者 https://example.com/example.ppt 这样的形式才能被预览,否则会显示无法打开文件。\n共享管理 通过右键复制的临时链接自动拥有一定时间的有效期(默认60分钟,可通过-share指令更改),到期后无法被下载。\n在右下角菜单中选择共享管理即可添加或减少共享时间,也可删除共享\n复制的永久链接除非移动文件或更改用户名密码,否则永远有效,不可删除。\n重启FolderMagic后,所有临时共享都会失效,永久连接依然有效\nAriaNG 通过右下角菜单可以调用内置的ariaNg,并默认指向/jsonrpc路径。FolderMagic将默认转发/jsonrpc到http://127.0.0.1:6800/jsonrpc (aria2 rpc默认路径),可通过-aria 指令更改转发地址\n/jsonrpc 需要被认证后才能访问(如果启用了认证的话),所以该转发是安全的,即便没有密码,其他人也无法连接到你的aria2rpc\n文件搜索 启动后FolderMagic即开始检索被列表的文件夹并监听文件夹的所有改动。\n可以在右下角菜单处打开搜索,也可使用Ctrl+F或者F3立刻开始搜索。\n索引文件占用少量内存(约3M/10k文件)。监听文件夹基于inotify,如果存在海量文件夹(如十几万个)则将会占用较多内存,甚至可能用完inotify的所有监听额度,请不要直接共享根目录。\n安全措施 启用鉴权后,FolderMagic将只允许授权用户登录,每个IP有5次密码试错机会,失败后将被禁用15分钟,期间FolderMagic任何服务都无法访问。\n推荐使用root用户,FolderMagic将使用chroot保护运行环境,完全避免由于潜在的bug而被黑到系统其他核心文件夹的机会。\n如不使用root,请开放对应用户的chroot权限。无权限时chroot将被禁用,安全性将被降低。\n由于chroot的使用,符号链接文件和符号链接文件夹可能无法使用,因为他们将指向一个完全不同的路径\nhttps FolderMagic 没有https的原生支持,你可以通过nginx或者caddy做前端来添加https的支持。\n假设你的FolderMagic绑定于127.0.0.1:81,以下例子仅供参考:\nnginx\nserver {\rlisten 443 ssl;\rserver_name 域名或ip;\radd_header Strict-Transport-Security \u0026#34;max-age=31536000; includeSubDomains; preload\u0026#34; always;\r#证书文件\rssl_certificate www.example.com.crt;\r#私钥文件\rssl_certificate_key www.example.com.key;\r#优先采取服务器算法\rssl_prefer_server_ciphers on;\rssl_protocols TLSv1 TLSv1.1 TLSv1.2;\rssl_ciphers \u0026#34;EECDH+ECDSA+AESGCM EECDH+aRSA+AESGCM EECDH+ECDSA+SHA384 EECDH+ECDSA+SHA256 EECDH+aRSA+SHA384 EECDH+aRSA+SHA256 EECDH+aRSA+RC4 EECDH EDH+aRSA !aNULL !eNULL !LOW !3DES !MD5 !EXP !PSK !SRP !DSS !RC4\u0026#34;;\rlocation / {\rproxy_buffering off;\r# 一定要加,否则FolderMagic在反代后不能识别客户ip,直接封锁全部用户\rproxy_set_header X-Real-IP $remote_addr;\rproxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\rproxy_pass http://127.0.0.1:81;\r}\r} 已知问题 初次访问的语言将被记录,此后访问将使用第一次访问的语言。可使用?lng=zh_CN或?lng=en强制切换到中文或英文 IE10及以下符号显示不正常,IE9及以下不能上传文件,切换文件夹将丢失当前正在预览的图像或音视频 360浏览器 由于奇葩的设计,极速模式下所有文件拖放上传功能都不可用,只能在兼容模式下的IE内核才能上传 和部分拖放打开的插件有冲突,会出现有时能拖放有时不能,或者拖放时页面闪烁等情况,只能对本列表页面禁用插件解决。\n","permalink":"https://zynismus16.github.io/posts/23/","summary":"FolderMagic 简单易用,无需部署的列表程序。 特性: 无需环境,无需数据库,低内存占用 支持webdav管理 支持视频在线播放,支持字幕(srt, ass, ssa, vtt等)","title":"FolderMagic:一键文件列表目录程序 支持webdav,字幕"},{"content":"Typecho数据库提供了非常易用的api,和原生SQL写法没有太大的差别,同时也很好地处理了SQL常见的安全问题,如sql注入。本文从实用角度出发,介绍了typecho操作数据库的常用场景以及相关api用法。\n表创建和删除 在Typecho插件开发过程中,往往需要创建自己的表。上文提到Typecho_Db类中的query函数,可用于执行所有sql语句,因此我们使用query()来进行表的创建、修改或者删除。\n$db= Typecho_Db::get();\r$prefix = $db-\u0026gt;getPrefix();\r$db-\u0026gt;query(\u0026#39;create table \u0026#39;.$prefix.\u0026#39;metas xxxxx\u0026#39;); 注意,使用query方式创建表的时候,需要在表明前手动添加$prefix前缀,否则在后面的使用过程中会造成困惑。 还可以使用table.来代替$prefix,typecho会自动识别并替换成指定的前缀。\n同理,修改或者删除Typecho数据库中表,按照同样的方式调用query即可。\n数据查询 select,查询表数据 select语句是可以说Typecho插件开发中最常用的sql调用。\n$db = Typecho_Db::get();\r$query= $db-\u0026gt;select()-\u0026gt;from(\u0026#39;table.metas\u0026#39;);\r$result = $db-\u0026gt;fetchAll($query); *说明: typecho中,.号具有特定的意义,这里table.metas表示这是一个metas表。实际上,typecho是自动将table.的字符使用str_replace替换成了config.inc.php中设定的前缀。\n举例:\n$db-\u0026gt;select()-\u0026gt;from(\u0026rsquo;table.metas\u0026rsquo;);将生成SELECT * FROM typecho_metas WHERE (mid = \u0026lsquo;2\u0026rsquo; ),其中typecho_是表前缀;\n而$db-\u0026gt;select()-\u0026gt;from(\u0026lsquo;metas\u0026rsquo;);将生成SELECT FROM metas WHERE (mid = \u0026lsquo;2\u0026rsquo; ),注意这里没有了表前缀。\n指定表字段查询 有时为了提高查询性能,需要指定查询表中特定的几个字段,那么可以使用下面的方式:\n$query= $db-\u0026gt;select(\u0026#39;mid\u0026#39;,\u0026#39;name\u0026#39;)-\u0026gt;from(\u0026#39;table.metas\u0026#39;);\recho $query; //SELECT `mid` , `name` FROM typecho_metas 如果联合查询中,两个表存在相同的字段名,那么可以使用table.来指定表名:\n$query = $db-\u0026gt;select(\u0026#39;table.contents.cid\u0026#39;)-\u0026gt;from(\u0026#39;table.contents\u0026#39;)-\u0026gt;join.... 指定查询条件\n指定SQL查询的where语句,是最常用的api调用。\n$query= $db-\u0026gt;select(\u0026#39;mid\u0026#39;,\u0026#39;name\u0026#39;)-\u0026gt;from(\u0026#39;table.metas\u0026#39;)-\u0026gt;where(\u0026#39;mid = ?\u0026#39;, 2);\recho $query; //SELECT * FROM typecho_metas WHERE (`mid` = \u0026#39;2\u0026#39; ) 如需要指定多个查询条件,直接多次调用where即可,将生成and关系的where条件\n$db-\u0026gt;select(\u0026#39;mid\u0026#39;,\u0026#39;name\u0026#39;)-\u0026gt;from(\u0026#39;table.metas\u0026#39;)-\u0026gt;where(\u0026#39;mid = ?\u0026#39;, 2)-\u0026gt;where(\u0026#39;name like ? \u0026#39;, $name); 使用OR关系的查询条件\n可以使用orWhere()函数来指定SQL查询的或条件。\n$db-\u0026gt;select(\u0026#39;mid\u0026#39;,\u0026#39;name\u0026#39;)-\u0026gt;from(\u0026#39;table.metas\u0026#39;)-\u0026gt;where(\u0026#39;mid = ?\u0026#39;, 2)-\u0026gt;orWhere(\u0026#39;mid = ? \u0026#39;, 3);\r//SELECT `mid` , `name` FROM typecho_metas WHERE (`mid` = \u0026#39;2\u0026#39; ) OR (`mid` = \u0026#39;3\u0026#39; ) 指定查询范围\n在需要分页的场景下,分页是必需的操作。offset()和limit()分别用于指定起始位置和结束位置,即指定查询范围。\n$query = $db-\u0026gt;select(\u0026#39;mid\u0026#39;,\u0026#39;name\u0026#39;)-\u0026gt;from(\u0026#39;table.metas\u0026#39;)-\u0026gt;offset(2)-\u0026gt;limit(3);\recho $query;//SELECT `mid` , `name` FROM typecho_metas LIMIT 3 OFFSET 2 Typecho中,还提供了一种简写的方法,见page()函数。\n$query = $db-\u0026gt;select(\u0026#39;mid\u0026#39;,\u0026#39;name\u0026#39;)-\u0026gt;from(\u0026#39;table.metas\u0026#39;)-\u0026gt;page(3,10);\recho $query;//SELECT `mid` , `name` FROM typecho_metas LIMIT 10 OFFSET 20\r//表示取第三页,并取10条记录。 对查询结果进行排序\n在Typecho中,使用order()函数和Typecho_Db::SORT_DESC指定查询结果的排序方式。\n$query = $db-\u0026gt;select(\u0026#39;mid\u0026#39;,\u0026#39;name\u0026#39;)-\u0026gt;from(\u0026#39;table.metas\u0026#39;)-\u0026gt;order(\u0026#39;mid\u0026#39;,Typecho_Db::SORT_DESC);\recho $query;//SELECT `mid` , `name` FROM typecho_metas ORDER BY `mid` DESC Typecho_Db::SORT_ASC 表示升序排序,Typecho_Db::SORT_DESC表示降序排序\n联合查询\n联合查询是SQL的常用语法,在Typecho中,同样使用内置函数join()方便地进行联合查询。\n$query = $db-\u0026gt;select()\r-\u0026gt;from(\u0026#39;table.contents\u0026#39;)\r-\u0026gt;join(\u0026#39;table.comments\u0026#39;, \u0026#39;table.contents.cid = table.comments.cid\u0026#39;,Typecho_Db::LEFT_JOIN)\r-\u0026gt;where(\u0026#39;table.contents.type = ?\u0026#39;, \u0026#39;post\u0026#39;);\recho $query;\r//SELECT * FROM typechocontents LEFT JOIN typecho_comments ON typecho_contents.`cid` = typecho_comments.`cid` WHERE (typecho_contents.`type` = \u0026#39;post\u0026#39; ) update,更新表数据 Typecho中,使用update()函数来进行更新表操作。但注意,update操作,需要借助于query执行。\n$update = $db-\u0026gt;update(\u0026#39;table.metas\u0026#39;)-\u0026gt;rows(array(\u0026#39;name\u0026#39;=\u0026gt;\u0026#39;case_in_cn\u0026#39;))-\u0026gt;where(\u0026#39;mid=?\u0026#39;,6);\recho $update;//UPDATE typecho_metas SET `name` = \u0026#39;some_name\u0026#39; WHERE (`mid`=\u0026#39;6\u0026#39; )\r//执行后,返回收影响的行数。\r$updateRows= $db-\u0026gt;query($update); insert,插入数据 Typecho中,使用insert()函数来进行表插入操作。同样,insert操作需要借助于query函数。\n$insert = $db-\u0026gt;insert(\u0026#39;table.metas\u0026#39;)\r-\u0026gt;rows(array(\u0026#39;mid\u0026#39; =\u0026gt; \u0026#39;22\u0026#39;, \u0026#39;name\u0026#39; =\u0026gt; \u0026#39;hello world\u0026#39;));\r//将构建好的sql执行, 如果你的主键id是自增型的还会返回insert id\r$insertId = $db-\u0026gt;query($insert); delete,删除数据 Typecho中使用delete()函数来删除数据表中的行。delete操作用于删除数据表中指定的行,同样需要借助query函数执行。\n$delete = $db-\u0026gt;delete(\u0026#39;table.metas\u0026#39;)\r-\u0026gt;where(\u0026#39;mid = ?\u0026#39;, 2);\r//将构建好的sql执行, 会自动返回已经删除的记录数\r$deletedRows = $db-\u0026gt;query($delete); 数据库调试 在Typecho调试过程中,打印sql语句往往是很有帮助的。对于大于5.2版本的php,直接echo $query即可,对于小于5.2版本,则需要显式调用__toString()函数\n$select = $db-\u0026gt;select()-\u0026gt;from(\u0026#39;table.metas\u0026#39;);\r//如果版本大于php5.2\recho $select;\r//如果小于php5.2\recho $select-\u0026gt;__toString(); ","permalink":"https://zynismus16.github.io/posts/24/","summary":"Typecho数据库提供了非常易用的api,和原生SQL写法没有太大的差别,同时也很好地处理了SQL常见的安全问题,如sql注入。本文从实用","title":"Typecho对数据库的增删查改"},{"content":"typecho后台的文件简单的功能对照说明,因为是本人自行的琢磨,没有看任何文档,所以肯定会有不足,不足之处请回复说明。发这个的原因是我觉得这样详细列出来,方便各位基友修改/重构typecho的后台模板。\n文件名 作用 welcome.php 博客首次安装成功的欢迎界面 common.php 检测是否为第一次登陆,检测程序是否可有升级 common-js.php 消息处理及后台菜单展开的js upgrade.php 程序升级引导 login.php 登陆界面 register.php 用户注册页面 header.php 头部加载css和js等 copyright.php 版权声明 form-js.php form对应的js table-js.php table对应的js footer.php 页脚 menu.php 菜单导航条 extending.php 插件拓展后台菜单的接口 page-title.php 页面标题 index.php 进入后台的首页,对应菜单为网站概要 profile.php 个人设置 plugins.php 插件管理 options-plugin.php 插件设置页面 themes.php 网站外观 theme-editor.php 编辑模板的页面 options-theme.php 设置模板的页面即模板后台 write-post.php 文章撰写页面 write-js.php 撰写文章/页面时的发布时间,标签,分类,保存草稿,高价设置 file-upload.php 文章/页面附件上传,及管理界面 file-upload-js.php 文章/页面附件上传,及管理功能 custom-fields.php 自定义字段界面 custom-fields-js.php 自定义字段功能实现 editor-js.php 编辑器 write-page.php 创建页面 manage-posts.php 管理文章界面 manage-pages.php 管理页面界面 manage-comments.php 管理评论界面 manage-categories.php 管理分类界面 category.php 某个分类的编辑页面 manage-tags.php 管理标签界面 manage-medias.php 所有文章的附件管理页面 media.php 某个附件的管理 manage-users.php 所有用户管理页面 user.php 编辑某个用户 options-general.php 网站基本设置页面 options-discussion.php 评论设置页面 options-reading.php 阅读设置页面 options-permalink.php 永久链接设置页面 ","permalink":"https://zynismus16.github.io/posts/25/","summary":"typecho后台的文件简单的功能对照说明,因为是本人自行的琢磨,没有看任何文档,所以肯定会有不足,不足之处请回复说明。发这个的原因是我觉得","title":"Typecho部分系统文件用途"},{"content":"一直想做个个人站 希望能记录自己生活的点点滴滴,能记录自己学习成长过程,能记录自己这个\u0026quot;健忘症\u0026quot;患者忘掉的东西。 于是它来了 不希望它将来能做多大,能有多少人访问。只求能记录,能回忆。过了多久后自己翻看到之前写的内容时能够会心一笑或者尬的抠juo。 不管怎样它都应该被我坚持运行下去!!!\n","permalink":"https://zynismus16.github.io/posts/26/","summary":"一直想做个个人站 希望能记录自己生活的点点滴滴,能记录自己学习成长过程,能记录自己这个\u0026quot;健忘症\u0026quot;患者忘掉的东西。 于是它来了","title":"“约定”"},{"content":" Hello World\r一个记录技术、阅读、生活的博客\r\u003e 以上排名不分先后 友链格式 名称: Hello World 网址: https://zynismus16.github.io 图标: https://zynismus16.github.io/favicon.png 描述: 一个记录技术、阅读、生活的博客 友链申请要求 秉承互换友链原则、文章定期更新、不能有太多广告、个人描述字数控制在15字内\n","permalink":"https://zynismus16.github.io/links/","summary":"Hello World 一个记录技术、阅读、生活的博客 \u003e 以上排名不分先后 友链格式 名称: Hello World 网址: https://zynismus16.github.io 图标: https://zynismus16.github.io/favicon.png 描述: 一个记录技术、阅读、生活的博客 友链申请要求 秉承互","title":"友链"},{"content":"\r“鬼”楼\r一枝梅花出墙来\r三峡大坝的柳树\r宜昌兰草谷\r小麦田\r微观世界\r成都人民广场大楼\r成都博物馆梅花鹿\r成都锦里\r成都锦里0\r成都锦里1\r成都锦里古玩市场\r成都高架\r新自行车\r梅花\r沙河公园\r海棠花\r海棠花1\r湖边夕阳\r重庆洪崖洞\r重庆洪崖洞对面\r重庆洪崖洞对面1\r锦里的大树\r雾中之森\r","permalink":"https://zynismus16.github.io/atlas/","summary":"“鬼”楼 一枝梅花出墙来 三峡大坝的柳树 宜昌兰草谷 小麦田 微观世界 成都人民广场大楼 成都博物馆梅花鹿 成都锦里 成都锦里0 成都锦里1 成都锦里古玩市场 成都","title":"图册"},{"content":"","permalink":"https://zynismus16.github.io/say/","summary":"","title":"说说"}]