htop 查看系统进程,发现几个 php-fpm8.1 进程占了 CPU 的百分之百,查看 php 日志 /var/log/php8.1-fpm.log,发现一水的如下提示:
WARNING: [pool www] server reached pm.max_children setting (5), consider raising it
综合了一下搜索内容,修改如下:
系统信息
Ubuntu Server 22.04 LTS 64bit
apt install 安装的 php8.1-fpm
apt install 安装的 nginx 1.18.0
修改 pm.max_childr...
话题php共有相关文章 3 篇。
explode 换行“\r\n”无效

PHP 使用 explode 函数将文本里的换行内容转换成数组,在本地测试时使用 \r\n 没问题,上传服务器后失效。
$txt = file_get_contents("mydatas.txt");
$arrs = explode("\r\n",$txt);
服务器是 Ubuntu 20,不知道啥情况。
搜索了一下,原来要这么写:
$arrs = explode(PHP_EOL,$txt);
PHP_EOL 是换行符的 PHP 默认常量,它会根据平台而变,在 Windows 下会是 /r/n,在 Linux 下是 /n,在 Mac 下是 /r。
PHP 过滤所有中英文标点

/** 过滤中英文标点符号 */
function filter_punctuation($text){
$text=urlencode($text);
$text=preg_replace("/(%E3%80%82|%EF%BC%9F|%EF%BC%81|%EF%BC%8C|%E3%80%81|%EF%BC%9B|%EF%BC%9A|%E2%80%9C|%E2%80%9D|%E2%80%98|%E2%80%99|%EF%BC%88|%EF%BC%89|%E3%80%8A|%E3%80%8B|%E3%80%88|%E3%80%89|%E3%80%90|%E3%80%91|...
最新评论