升级Wordpress所用的PHP
以升级php8.3到php8.4为例
- 查看目前php版本
phv -v
- 添加最新PHP的存储库
sudo add-apt-repository ppa:ondrej/php
sudo apt update
- 安装PHP8.4
sudo apt install php8.4 php8.4-fpm php8.4-{cli,curl,gd,mysql,mbstring,xml,zip,imagick,intl}
- 更新nginx配置文件中的php-fpm调用,以我的/etc/nginx/sites-available/wordpress 为例
- fastcgi_pass unix:/run/php/php8.3-fpm.sock;
+ fastcgi_pass unix:/run/php/php8.4-fpm.sock; - 重启nginx和php-fpm
sudo systemctl restart php8.4-fpm nginx
- 按老版本更新www.conf运行器池配置
diff /etc/php/8.3/fpm/pool.d/www.conf /etc/php/8.4/fpm/pool.d/www.conf
- 删除老版本PHP
sudo systemctl stop php8.3-fpm
sudo systemctl disable php8.3-fpm
sudo apt-get purge php8.3*
sudo rm -rf /etc/php/8.3
sudo apt autoremove
如何在 WordPress 中显示 ☐ , ☑ , ✓ , ✔。
下面是对应的 HTML 图标数位
☐ – ☐
☑ – ☑
☒ – ☒
✓ – ✓
✔ – ✔
✗ – ✗
✘ – ✘
✅ ❎⏳🗴 🗶 ⮽ 🗵 🗹 🗷
页脚显示页面加载时间的方法
将下面的代码添加到当前主题的 functions.php 文件:
//显示页面查询次数、加载时间和内存占用
function performance( $visible = false ) {
$stat = sprintf( '本次加载耗时:%.3fs',
timer_stop( 0, 3 )
);
echo $visible ? $stat : "<!-- {$stat} -->" ;
}
然后可以在需要显示的地方,使用下面的代码进行调用:
<?php if(function_exists('performance')) performance(true) ;?>