apache 404错误,Apache服务开启后,访问资源显示403错误被拒绝?
问题描述在CentOS7.9系统上通过源码编译部署了Apache应用,默认安装在/usr/local/apache/路径下。希望通过Apache来实现WordPress应用,将WordPress的相关
顺晟科技
2022-09-15 09:22:25
140
最近在研究关于php生成图片的东西,发现了 imagettftext() 函数中一个不是错误的错误,具体的错误情况如下所示。
错误代码:
imagettftext(): any2eucjp(): invalid code in input string
错误原因:
在编译php的时候,开启了 --enable-gd-jis-conv 这个选项,而这个选项是对日文的支持,而我们使用utf-8编码的中文时会被识别成日本,所以会抛出一个错误,通俗来说这个错误是一个php本身的BUG,并不是代码的问题。
解决方法:
下面提供两种解决方法,看自己使用那一种。
1、重新编译php,并关闭 --enable-gd-jis-conv 这个选项
2、对字符串进行一个处理
处理代码如下:
// 这里是一个处理函数 function to_entities($string) { $len = strlen($string); $buf = ""; for($i = 0; $i < $len; $i++){ if (ord($string[$i]) <= 127){ $buf .= $string[$i]; } else if (ord ($string[$i]) <192){ $buf .= "�"; } else if (ord ($string[$i]) <224){ $buf .= sprintf("&#%d;", ((ord($string[$i + 0]) & 31) << 6) + (ord($string[$i + 1]) & 63) ); $i += 1; } else if (ord ($string[$i]) <240){ $buf .= sprintf("&#%d;", ((ord($string[$i + 0]) & 15) << 12) + ((ord($string[$i + 1]) & 63) << 6) + (ord($string[$i + 2]) & 63) ); $i += 2; } else { $buf .= sprintf("&#%d;", ((ord($string[$i + 0]) & 7) << 18) + ((ord($string[$i + 1]) & 63) << 12) + ((ord($string[$i + 2]) & 63) << 6) + (ord($string[$i + 3]) & 63) ); $i += 3; } } return $buf; } //函数的使用 imagettftext($im, 11, 0, 5, 11, $black, $font, to_entities($text));
29
2022-10
24
2022-10
15
2022-09
15
2022-09
06
2022-09
24
2021-10