【发布时间】:2019-01-09 03:29:19
【问题描述】:
我已经为图像开发了这个代码,但问题是我的文字没有出现在这个图像上,请帮忙!代码运行良好,没有错误。显示此代码中提到的白色图像。
<?php
//Set the Content Type
header('Content-type: image/jpg');
$w=730;
$h=450;
$image=imagecreate($w,$h);
$text='hello world';
$whitebackground=imagecolorallocate($image,255,255,255);
$blacktext=imagecolorallocate($image,0,0,0);
$font =$font_path = dirname(__FILE__) . '/themify.ttf';
imagettftext($image,40,0,50,50,$blacktext,$font,$text);
imagejpeg($image);
ini_set("log_errors", 1); ini_set("error_log", "php-error.log");
?>
【问题讨论】:
-
你应该真正设置你的日志配置之前调用函数。到你在这里做的时候,捕捉任何有用的东西已经太晚了。
-
怎么做我是php新手
-
只需将带有
ini_set调用的行移至顶部即可。 -
日志文件为空