我是laravel 4.2的新手,我正在思考如何显示从php文件生成的图像。
这是我的php文件(capt.php)
<?php
session_start();
$code=rand(100000,999999);
$_SESSION["code"]=$code;
$im = imagecreatetruecolor(50, 24);
$bg = imagecolorallocate($im, 189, 195, 199); //background color blue
$fg = imagecolorallocate($im, 255, 255, 255);//text color white
imagefill($im, 0, 0, $bg);
imagestring($im, 5, 5, 5, $code, $fg);
header("Cache-Control: no-cache, must-revalidate");
header('Content-type: image/png');
imagepng($im);
imagedestroy($im);
?>
它只生成随机生成数字的图像。
我只是把php文件放在应用程序下面,然后我把它称为我的刀片
{{ HTML::image(URL::to('capt.php')) }}