教程

Wordpress教程

Warning: Undefined variable $output in /www/wwwroot/maoshuai.cn/wp-content/themes/leopard/functions.php on line 56

Wordpress添加显示页面加载时间、消耗内存、数据库查询次数代码
173字

显示效果如下: 只需在Wordpress主题的footer.php文件中添加如下代码 页面生成用时<?php timer_stop(1); ?>秒,SQL查询<?php echo get_num_queries(); ?>次,内存<?php echo memory_get_peak_usage()/10 ....

分享

Warning: Undefined variable $output in /www/wwwroot/maoshuai.cn/wp-content/themes/leopard/functions.php on line 56

添加控制台彩蛋 Console调试信息
959字

最近无意间了解到了百度的控制台彩蛋 百度控制台彩蛋 就在网上找了相关代码 发现JavaScript是可以像Java 易语言一样在控制台输出调试信息的 整合找了一段比较漂亮的代码 <script type="text/javascript"> console.log('hello,Welcome to 67\' Blog! ....

PHP教程

Warning: Undefined variable $output in /www/wwwroot/maoshuai.cn/wp-content/themes/leopard/functions.php on line 56

PHP代码编写规范
5090字

FIG制定的 PHP 规范,简称 PSR,是 PHP 开发的事实标准。FIG 是 Framework Interoperability Group (框架可互用小组) 的缩写,由几位开源框架的开发者成立于 2009 年。该组织的目的在于:以最低程度的限制 ....

PHP教程

Warning: Undefined variable $output in /www/wwwroot/maoshuai.cn/wp-content/themes/leopard/functions.php on line 56

PHP如何计算字符串长度
419字

php中常见的计算字符串长度的函数有:strlen()和mb_strlen()两个函数 区别 strlen()是PHP内置函数,但是他无法正确处理中文字符串,它得到的只是字符串所占的字节数。对于GB2312的中文编码,strlen得到的值是汉字个数的2倍,而对于UTF-8编码的中文,就是3倍(在 UTF-8编码下,一个汉字占3个字节 ....

PHP教程

Warning: Undefined variable $output in /www/wwwroot/maoshuai.cn/wp-content/themes/leopard/functions.php on line 56

PHP 替换字符串函数
763字

在PHP程序开发中,经常可以遇到需要替换字符串的场景,下面列出几种实现方式。 PHP 中替换函数主要有 strtr() 和 str_repalce() 这两个函数 strtr() 函数 strtr(string, from, to) 或 strtr(string, array) 首先针对 strtr() 函数第一种方式,我们看看下面 ....

Wordpress教程

Warning: Undefined variable $output in /www/wwwroot/maoshuai.cn/wp-content/themes/leopard/functions.php on line 56

为WordPress添加显示文章图片、文字个数和阅读时间功能
1569字

本教程根据网络整合并在本站应用后得出。 首先在网站模板的functions.php中添加以下代码: //字数、图片个数和预计阅读时间统计 function count_words_img_read_time () { global $post; $content = $post->post_content; preg_matc ....

分享

Warning: Undefined variable $output in /www/wwwroot/maoshuai.cn/wp-content/themes/leopard/functions.php on line 56

为站点增加了建站时间显示
1147字

为站点增加了时间显示,效果如下: 站点建站时间展示效果图 具体代码: <span id="sitetime"></span> <!--显示建站时间的地方放置此代码 可以加上其他代HTML代码加粗颜色等--> <script language=javascript> function s ....