我发现这个软件包,我试图运行该示例并显示括号。锦标赛生成器PHP
但它输出一些奇怪的字符:
�PNG IHDR�Ht�4PLTE���U��~�IDATx����o�V��GIW&q�*�=ު`B�&��?�?!R*Mv�
你明白了吧。
我在想,这是因为:
// If GD-lib is installed, the below code will draw the bracket of the knock-out tournament.
if ($GDLIB_INSTALLED) {
$im = $KO->getImage("Tournament name here");
header('Content-type: image/png');
imagepng($im);
imagedestroy($im);
}
但我不知道如何解决它....
感谢, 阿糖胞苷
编辑:
所以我在gat说了什么之后,稍微改变了一下代码。
在我的控制,我得到: 公共职能getTest(){
// Depending on whether or not GD-lib is installed this example file will output differently.
$GDLIB_INSTALLED = (function_exists("gd_info")) ? true : false;
// Lets create a knock-out tournament between some of our dear physicists.
$competitors = array(
'Paul A.M. Dirac',
'Hans Christian Oersted',
'Murray Gell-Mann',
'Marie Curie',
'Neils Bohr',
'Richard P. Feynman',
'Max Planck');
// Create initial tournament bracket.
$KO = new TournamentGeneratorGD($competitors);
$KO->setResByMatch(1, 1, 4, 0);
if($GDLIB_INSTALLED){
$im = $KO->getImage("Tournament name here");
return View::make('test_img')
->with('im', $im);
}
else
return View::make('home');
}
而且在我test_img.php页,我得到这个:
<?php
header('Content-type: image/png');
imagepng($im);
imagedestroy($im);
?>
它不反正工作..
您是否安装了GD库? – j08691
是所有的代码?因为它看起来像头没有被应用,头文件已经发送错误? ; p –
@劳伦斯,不,它不是所有的代码。但我改变了什么加特说,它并没有解决它tho ... –