如何在WordPress网站中添加注释功能?

摘要:线上网站建设,wordpress注释,考证培训机构报名网站,php一台电脑做网站第一版: https:mp.csdn.netmp_blogcreationeditor131979385 第二版&am
线上网站建设,wordpress注释,考证培训机构报名网站,php一台电脑做网站第一版#xff1a; https://mp.csdn.net/mp_blog/creation/editor/131979385 第二版#xff1a; 优化内容#xff1a; 检索数据的两种方式#xff1a; 1.严格模式--找寻名称是一模一样的内容#xff0c;在上一个版本实现了 2.包含模式#xff0c;也就是我输入检索关… 第一版 https://mp.csdn.net/mp_blog/creation/editor/131979385 第二版 优化内容 检索数据的两种方式 1.严格模式--找寻名称是一模一样的内容在上一个版本实现了 2.包含模式也就是我输入检索关键字“语音配线架”【原来名称为‘50对语音配线架’】这样可以快速找到同类别的内容 代码 package mainimport (fmtgithub.com/xuri/excelize/v2strings )//eve sheet name的内容// InSlice 判断字符串是否在 slice 中。 func InSlice(items []string, item string) bool {for _, eachItem : range items {if eachItem item {return true}}return false }// InSlice 判断字符串是否在 slice 中。 func includeSlice(items []string, item string) bool {for _, eachItem : range items {//字符串包含函数判断表格中名字是否包含我的列表中的内容//这样我的找寻字符串中写入关键字就可以了if strings.Contains(item, eachItem) {return true}}return false }// 我需要检索的信息 // var devicelists []string []string{50对语音配线架, 24口网络配线架, 24口网络理线架, 4口终端盒, 光纤收发器, 96芯光纤配线架} var devicelists []string{50对语音配线架, 24口网络配线架, 24口网络理线架, 4口终端盒, 光纤收发器, 96芯光纤配线架}var keydevicelists []string{语音配线架, 网络配线架, 网络理线架, 终端盒, 光纤收发器, 光纤配线架}func sheet(sheetname string, f *excelize.File, format int) {//fmt.Println()// 获取 Sheet1 上所有单元格rows, err : f.GetRows(sheetname)if err ! nil {fmt.Println(err)return}//fmt.Println(rows)for _, row : range rows {//fmt.Println(row, , index)//判断每行的里的字段长度如果是小于6 那就是不获取设备名字和设备价格if len(row) 6 {continue}//获取excel中设备的名称kindname : row[1]//获取excel中设备的数量kcount : row[4]//如果表格中 kcount没有内容那就是给复制一个“0”字符串if kcount {kcount 0}//fmt.Printf(固定列名字是:%s,类别是%T, kindname, kindname)//fmt.Println()//调用函数 用来判断 设备名称是否是我需要寻找的内容//如果是我需要寻找的内容就是返回对应表的名称以及 设备名称和 对应数量//if InSlice(devicelists, kindname) {// //fmt.Println(sheetname, kindname, 》, kcount)// fmt.Printf(获取信息:sheet表%s;设备名称%s;设备数量%s\n;, sheetname, kindname, kcount)// //fmt.Println()//}//判断模式可以进行采用 不同的检索方式//1.包含模式我检索的都是“关键字” 2.严格模式 内容必须得一模一样的查找if format 1 {//fmt.Println(你匹配的模式为包含模式)//包含的调用if includeSlice(keydevicelists, kindname) {//fmt.Println(sheetname, kindname, 》, kcount)fmt.Printf(获取信息:sheet表%s;设备名称%s;设备数量%s\n;, sheetname, kindname, kcount)//fmt.Println()}} else {//fmt.Println(你匹配的模式为严格模式)if InSlice(devicelists, kindname) {//fmt.Println(sheetname, kindname, 》, kcount)fmt.Printf(获取信息:sheet表%s;设备名称%s;设备数量%s\n;, sheetname, kindname, kcount)//fmt.Println()}}}//fmt.Println()//指定单元格的值,查询//value, _ : f.GetCellValue(sheetname, B7)//fmt.Println(value)//for _, row : range rows {// for _, colCell : range row {// fmt.Print(colCell, \t)// }// fmt.Println()//}}func sheetv2(sheetname string, f *excelize.File) {//fmt.Println()// 获取 Sheet1 上所有单元格rows, err : f.GetRows(sheetname)if err ! nil {fmt.Println(err)return}//fmt.Println(rows)for _, row : range rows {//fmt.Println(row, , index)//判断每行的里的字段长度如果是小于6 那就是不获取设备名字和设备价格if len(row) 6 {continue}//获取excel中设备的名称kindname : row[1]//获取excel中设备的数量kcount : row[4]//如果表格中 kcount没有内容那就是给复制一个“0”字符串if kcount {kcount 0}//fmt.Printf(固定列名字是:%s,类别是%T, kindname, kindname)//fmt.Println()//调用函数 用来判断 设备名称是否是我需要寻找的内容//如果是我需要寻找的内容就是返回对应表的名称以及 设备名称和 对应数量//if InSlice(devicelists, kindname) {// //fmt.Println(sheetname, kindname, 》, kcount)// fmt.Printf(获取信息:sheet表%s;设备名称%s;设备数量%s\n;, sheetname, kindname, kcount)// //fmt.Println()//}//包含的调用if includeSlice(devicelists, kindname) {//fmt.Println(sheetname, kindname, 》, kcount)fmt.Printf(获取信息:sheet表%s;设备名称%s;设备数量%s\n;, sheetname, kindname, kcount)//fmt.Println()}}//fmt.Println()//指定单元格的值,查询//value, _ : f.GetCellValue(sheetname, B7)//fmt.Println(value)//for _, row : range rows {// for _, colCell : range row {// fmt.Print(colCell, \t)// }// fmt.Println()//}} func sheet_bak(sheetname string, f *excelize.File) {// 获取 Sheet1 上所有单元格rows, err : f.GetRows(sheetname)if err ! nil {fmt.Println(err)return}for _, row : range rows {for _, colCell : range row {fmt.Print(colCell, \t)}fmt.Println()}}// 读取Excel表格 func main() {//选择的匹配模式1-包含模式2-严格模式var mode intf, err : excelize.OpenFile(by.xlsx)if err ! nil {fmt.Println(err)return}defer func() {if err : f.Close(); err ! nil {fmt.Println(err)}}()sheetnames : f.GetSheetList()//fmt.Printf(本excel表格的sheetnames:%s, sheetnames)//fmt.Println()for {fmt.Println(请输入你需要的匹配模式1-包含模式2-严格模式,输入 1 或者 2 :)fmt.Scan(mode)//退出内容if mode 88 {break}//遍历所有的表格sheet,调用处理函数for _, sheetname : range sheetnames {//fmt.Println(sheetname)sheet(sheetname, f, mode)}}}