dongyingdao8867 2015-05-24 20:08
浏览 28
已采纳

获取用于创建图像的变量

I'm making my own 'captcha' form and I now have a page that generates the image:

<?php
   header('Content-Type: image/png');
   $im = imagecreatetruecolor(200, 50);

   $white = imagecolorallocate($im, 255, 255, 255);
   $gray = imagecolorallocate($im, 160, 160, 160);

   imagefilledrectangle($im, 0, 0, 200, 50, $white);

   $captcha = "SOMErandomTEXT";

   $font = 'Chewy.ttf';

   imagettftext($im, 20, 0, 0, 20, $gray, $font, $captcha);

   imagepng($im);
   imagedestroy($im);
?>

Now I also have another page that shows this image, inside the form. Now I want to get the value $captcha from the page shown above on the other page. How can I do it?

  • 写回答

1条回答 默认 最新

  • duandong1869 2017-11-26 16:07
    关注

    Using sessions did the job for me. PHP Sessions

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥16 Qphython 用xlrd读取excel报错
  • ¥15 单片机学习顺序问题!!
  • ¥15 ikuai客户端多拨vpn,重启总是有个别重拨不上
  • ¥20 关于#anlogic#sdram#的问题,如何解决?(关键词-performance)
  • ¥15 相敏解调 matlab
  • ¥15 求lingo代码和思路
  • ¥15 公交车和无人机协同运输
  • ¥15 stm32代码移植没反应
  • ¥15 matlab基于pde算法图像修复,为什么只能对示例图像有效
  • ¥100 连续两帧图像高速减法