红色部分显示错误 就大神指教 谢谢

qq_16381249 2014-09-17 12:10:35
session_start();
$width=60;
$height=20;
$img=imagecreatetruecolor($width,$height);
$time=4;
$arr2=range(0,9);
$arr=array_merge($arr2);
$keys=array_rand($arr,$time);
$str="";
foreach($keys as $i)
$str.=$arr($i);
$_SESSION["randValid"]=$str;
for($i=0;$i<$time*2;$i++){
$color=imgecolorallocate($img,rand(0,156),rand(0,156),rand(0,156),);
imageline($img,rand(0,$width),rand(0,$height),rand(0,$width),rand(0,$height),$color);
$color=imagecolorallocate($img,rand(0,255),rand(0,255),rand(0,255),);
imagesetpixel($img,rand(0,$width),rand(0,$height),$color);
}
$color=imagecolorallocate($img,255,255,255);
imagestring($img,5,5,3,$str,$color);
header("content-type:image/png");
imagepng($img);
imagedestroy($img);
?>
...全文
95 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
xuzuning 2014-09-17
  • 打赏
  • 举报
回复
$str.=$arr($i); 应为 $str .= $arr[$i];
hellojcl 2014-09-17
  • 打赏
  • 举报
回复
基础得扎实。

20,359

社区成员

发帖
与我相关
我的任务
社区描述
“超文本预处理器”,是在服务器端执行的脚本语言,尤其适用于Web开发并可嵌入HTML中。PHP语法利用了C、Java和Perl,该语言的主要目标是允许web开发人员快速编写动态网页。
phpphpstorm 技术论坛(原bbs)
社区管理员
  • 开源资源社区
  • phpstory
  • xuzuning
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧