上一页 1 ··· 4 5 6 7 8 9 10 11 12 ··· 34 下一页
摘要: 什么是 WordPress 自定义字段 Custom Fields 我们在使用 WordPress 撰写日志或者页面的时候,都会在编辑框下面看到自定义字段(Custom Fields),那么什么是自定义字段呢?这个 WordPress 自定义字段又是干什么的? WordPress 自定义字段是对 W 阅读全文
posted @ 2020-02-07 01:14 Ryan_zheng 阅读(2999) 评论(0) 推荐(0) 编辑
摘要: 数据平台中有使用 Redis 来给线上提供低延时(20毫秒以内)的高并发读写请求,其中最大的Redis使用了阿里云的Redis集群(256G),存储的记录超过10亿,Key的有效期设置为15天,每天写入的记录大概5000万左右,QPS大概在6万左右。由于过期Key的产生速度大于Redis自动清理的速 阅读全文
posted @ 2020-02-05 22:20 Ryan_zheng 阅读(5052) 评论(0) 推荐(0) 编辑
摘要: 默认 Wordpress 的 Page 页面是按照 Title 升序排序的,如果创建的页面很多,使用起来会很不方面,所以可以通过将以下代码添加到 functions.php 中,实现将 Page 页面按照 Date 倒序 // 将 Page 页面默认排序修改为按照 Date 倒序 function 阅读全文
posted @ 2020-02-05 12:10 Ryan_zheng 阅读(1019) 评论(0) 推荐(0) 编辑
摘要: 使用以下代码,可以获取当天的汇率进行货币转换 function convert_currency($number, $currency) { // Fetching JSON $req_url = 'https://api.exchangerate-api.com/v4/latest/USD'; $ 阅读全文
posted @ 2020-01-20 16:07 Ryan_zheng 阅读(1788) 评论(3) 推荐(0) 编辑
摘要: 网站开发时经常遇到需要追踪链接跳转是否正确的需求, 例如在浏览器输入一个链接 https://www.ryanzoe.top/git/how-to-revert-git 由于链接输入不完整,但是我有配置 301 跳转到完整的文章链接,所以最终地址栏显示的链接为 https://www.ryanzoe 阅读全文
posted @ 2020-01-20 12:21 Ryan_zheng 阅读(6036) 评论(0) 推荐(1) 编辑
摘要: 安装扩展 phpformatter 安装完成后,将文档进行格式化后,就会变成如下的代码格式 安装插件后,也可以对格式化进行配置 //打印日志信息,用于调试 "phpformatter.logging": true, //不使用composer方式 "phpformatter.composer": f 阅读全文
posted @ 2020-01-14 08:48 Ryan_zheng 阅读(9195) 评论(0) 推荐(1) 编辑
摘要: Wordpress 插件 Yoast SEO 会默认添加上结构化数据 但是这种结构化数据内容有限,如果需要添加自定义的结构化数据,就需要安装一些专门做结构化数据优化的插件,所以这些结构化插件都会有一个选项,就是不加载 SEO 默认的结构话数据,我们也可以将以下代码移除 SEO data struct 阅读全文
posted @ 2020-01-06 11:34 Ryan_zheng 阅读(287) 评论(0) 推荐(0) 编辑
摘要: ls -l 之后会得到下面的内容 drwx 4 jinwang users 4096 2012-02-09 15:00 .xchat2 -rw-r--r-- 1 jinwang users 1690399 2012-06-04 12:16 45s.txt 文件是以 "-"开头 , 文件夹是 d, 所 阅读全文
posted @ 2020-01-03 12:04 Ryan_zheng 阅读(12167) 评论(0) 推荐(0) 编辑
摘要: WordPress 提供了一个,timer_stop()函数, 官方给出的介绍为:检索或显示从页面开始到调用函数的时间。 简单的说就是我们访问一个 WordPress 链接,服务器生成处理这个页面所需要的时间,当然这并不是指我们打开或者加载这个页面的时间。更多的是服务器端的处理速度和 WordPre 阅读全文
posted @ 2019-12-31 12:04 Ryan_zheng 阅读(970) 评论(0) 推荐(0) 编辑
摘要: $args = array( 'post_type' => array( 'post','knowledgebase'), 'post_status' => 'publish', 'author' => $author_id, 'numberposts'=> $author_all_posts ); 阅读全文
posted @ 2019-12-04 11:55 Ryan_zheng 阅读(561) 评论(0) 推荐(0) 编辑
摘要: 使用 setcookie 函数设置 cookie 报错,报错信息为: setcookie() expects parameter 3 to be integer, float given in... 错误代码 setcookie("user_name", $username, time()+3153 阅读全文
posted @ 2019-12-03 23:03 Ryan_zheng 阅读(992) 评论(0) 推荐(0) 编辑
摘要: wordpress 获取指定作者或者文章的所有评论数量 <?php $args = array( 'post_author' => '' // fill in post author ID ); $author_comments = get_comments($args); echo count($ 阅读全文
posted @ 2019-12-03 17:30 Ryan_zheng 阅读(821) 评论(0) 推荐(0) 编辑
摘要: 通常情况下,为文件添加链接后,用户可以通过点击链接,直接将文件下载到本地,如下载 excel 表格等 <a href="/user/test/xxxx.excel">点击下载</a> 但是有个情况,比如 txt, png, jpg等这些浏览器支持直接打开的文件是不会执行下载任务的,而是会直接打开文件 阅读全文
posted @ 2019-11-30 11:23 Ryan_zheng 阅读(30862) 评论(0) 推荐(1) 编辑
摘要: 一、官网下载对应 PHP 版本的代码库 https://phpunit.de/getting-started-with-phpunit.html 二、安装 PHPUnit 官网提供了两种方法安装 1. PHP Archive (PHAR) ➜ wget -O phpunit https://phar 阅读全文
posted @ 2019-11-28 17:10 Ryan_zheng 阅读(2551) 评论(0) 推荐(0) 编辑
摘要: 首次安装完成 phpstudy 后,默认的 my.ini 配置只有数据库文件位置,其他的都没有设置,这时如果想要输出数据库中的中文后,显示到页面上就会变成中文乱码 解决方法: 打开 phpstudy 配置中的 my.ini,在最后添加下面的配置,然后重启 mysql 即可 [client] defa 阅读全文
posted @ 2019-11-25 14:05 Ryan_zheng 阅读(1771) 评论(0) 推荐(0) 编辑
上一页 1 ··· 4 5 6 7 8 9 10 11 12 ··· 34 下一页