当前位置:Gxlcms > PHP教程 > 帮助文档里的事例输出乱码请求教,该怎么处理

帮助文档里的事例输出乱码请求教,该怎么处理

时间:2021-07-01 10:21:17 帮助过:17人阅读

帮助文档里的事例输出乱码 请求教
这是从帮助文档上考下来的事例 但为什么输出是乱码呢 怎么解决
PHP code
  1. <!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--><!--?php header("Content-type: image/jpeg"); $im = imagecreate(400,30); $white = imagecolorallocate($im, 255,255,255); $black = imagecolorallocate($im, 0,0,0); // Replace path by your own font path imagettftext($im, 20, 0, 10, 20, $black, "/path/arial.ttf", "Testing... Omega: &#937;"); imagejpeg($im); imagedestroy($im);?-->


输出结果:

Warning: imagettftext() [function.imagettftext]: Invalid font filename in F:\wamp\www\bkqs\imageCode\file.php on line 9
??JFIF?>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality ?C    $.' ",#(7),01444'9=82<.342?C  2!!22222222222222222222222222222222222222222222222222??"? ??}!1AQa"q2亼?#B绷R佯$3br? %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz儎厗噲墛挀敃枟槞殺¥ウЖ┆渤吹斗腹郝媚牌侨墒矣哉肿刭卺忏溴骁栝犟蝮趱鲼? ??w!1AQaq"2?B憽绷 #3R?br?$4??&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz們剠唶垑姃摂晼棙櫄ⅲぅΗī炒刀犯购旅呐魄壬室釉罩棕仝忏溴骁栝牝篝貊鼬? ?鼹( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( (???


------解决方案--------------------
错误不是很明显吗?
Warning: imagettftext() [function.imagettftext]: Invalid font filename in F:\wamp\www\bkqs\imageCode\file.php on line 9
------解决方案--------------------
Invalid font filename
字体文件位置不正确。

试试这样。
imagettftext($im, 20, 0, 10, 20, $black, dirname(__FILE__) . "/../path/arial.ttf",

人气教程排行