搜索

首页  >  问答  >  正文

for循环赋值问题?

http://www.php.cn/code/5179.html

这个教程里的把for循环出来的信息赋值到session,这样循环出来只获取到一个数字;


for($i=0;$i<4;$i++){
   $color=imagecolorallocate($image,rand(0,255),rand(0,255),rand(0,255));
   $x=100/4*$i+7;
   $y=rand(0,20);
   $size=6;
   $content=rand(0,9);
   $yzxx="$content";
   imagestring($image,$size,$x,$y,$content,$color);
}
$_SESSION['yzxx']=$yzxx;
var_dump($_SESSION);

杜文涛杜文涛2674 天前1273

全部回复(1)我来回复

  • 路过

    路过2017-10-10 16:30:08

    $yzxx .= "$content"; 你的等号前面少了个“.”

    回复
    1
  • 杜文涛

    谢谢了 新手不太会

    杜文涛 · 2017-10-10 19:35:48
    杜文涛

    看了下教程 教程里都写错了吧

    杜文涛 · 2017-10-10 19:40:29
    路过

    谁不是从新手过来的呢?加油

    路过 · 2017-10-11 08:41:45
  • 取消回复