帮忙看下哪里有错误
<?php
require '../../../../../public_file/database_connection.php';
$结果集=mysql_query("select * from 字符表");
$某行=mysql_fetch_array($结果集);
$a=$某行['字符大小'];
$b=$某行['字符角度'];
$c=$某行['字符横轴位置'];
$d=$某行['字符纵轴位置'];
$e=$某行['字体'];
$f=$某行['字符'];
$画布 = imagecreate(5120,4862);
imagecolorallocate($画布, 255,255,255);
$前景颜色=imagecolorallocate($画布,0,0,0);
imagettftext($画布,$a,$b,$c,$d,$前景颜色,$e,$f);
header("content-type:image/png");
imagepng($画布);
imagedestroy($画布);
?>
慕容st 发表于2017-05-02 18:27
$结果集=mysql_query("select * from 字符表");
$某行=mysql_fetch_array($结果集);
这部分的代码,从数据库查询完字符表之后,没有进行while循环吗?是否可将实际代码粘贴上来?
SET FOREIGN_KEY_CHECKS = 0;
DROP TABLE IF EXISTS `zi_fu_biao`;
CREATE TABLE `zi_fu_biao` (
`id` int(30) NOT NULL AUTO_INCREMENT,
`zi_fu` varchar(1000) DEFAULT NULL COMMENT '字符',
`zi_fu_da_xiao` int(11) DEFAULT NULL COMMENT '字符大小',
`zi_fu_jiao_du` int(11) DEFAULT NULL COMMENT '字符角度',
`zi_fu_heng_zhou_wei_zhi` int(11) DEFAULT NULL COMMENT '字符横轴位置',
`zi_fu_zong_zhou_wei_zhi` int(11) DEFAULT NULL COMMENT '字符纵轴位置',
`zi_ti` varchar(200) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '字体',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8;
insert into `zi_fu_biao`(`id`,`zi_fu`,`zi_fu_da_xiao`,`zi_fu_jiao_du`,`zi_fu_heng_zhou_wei_zhi`,`zi_fu_zong_zhou_wei_zhi`,`zi_ti`) values
('7','abc','100','0','100','200','../../../../../../myfolder/Fonts/simfang.ttf'),
('8','vbn','80','0','120','250','../../../../../../myfolder/Fonts/simfang.ttf');
SET FOREIGN_KEY_CHECKS = 1;
<?php
require '../../../../../public_file/database_connection.php';
$jie_guo_ji=mysql_query("select * from zi_fu_biao");
$mou_hang=mysql_fetch_array($jie_guo_ji);
$a=$mou_hang['zi_fu_da_xiao'];
$b=$mou_hang['zi_fu_jiao_du'];
$c=$mou_hang['zi_fu_heng_zhou_wei_zhi'];
$d=$mou_hang['zi_fu_zong_zhou_wei_zhi'];
$e=$mou_hang['zi_ti'];
$f=$mou_hang['zi_fu'];
$hua_bu= imagecreate(5120,4862);
imagecolorallocate($hua_bu, 255,255,255);
$qian_jing_yan_se=imagecolorallocate($hua_bu,0,0,0);
imagettftext($hua_bu,$a,$b,$c,$d,$qian_jing_yan_se,$e,$f);
header("content-type:image/png");
imagepng($hua_bu);
imagedestroy($hua_bu);
?>
13723868561 发表于2017-05-02 20:15
SET FOREIGN_KEY_CHECKS = 0;
DROP TABLE IF EXISTS `zi_fu_biao`;
CREATE TABLE `zi_fu_biao` (
`id` int(30) NOT NULL AUTO_INCREMENT,
`zi_fu` varchar(1000) DEFAULT NULL COMMENT '字符',
`zi_fu_da_xiao` int(11) DEFAULT NULL COMMENT '字符大小',
`zi_fu_jiao_du` int(11) DEFAULT NULL COMMENT '字符角度',
`zi_fu_heng_zhou_wei_zhi` int(11) DEFAULT NULL COMMENT '字符横轴位置',
`zi_fu_zong_zhou_wei_zhi` int(11) DEFAULT NULL COMMENT '字符纵轴位置',
`zi_ti` varchar(200) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '字体',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8;
insert into `zi_fu_biao`(`id`,`zi_fu`,`zi_fu_da_xiao`,`zi_fu_jiao_du`,`zi_fu_heng_zhou_wei_zhi`,`zi_fu_zong_zhou_wei_zhi`,`zi_ti`) values
('7','abc','100','0','100','200','../../../../../../myfolder/Fonts/simfang.ttf'),
('8','vbn','80','0','120','250','../../../../../../myfolder/Fonts/simfang.ttf');
SET FOREIGN_KEY_CHECKS = 1;
<?php
require '../../../../../public_file/database_connection.php';
$jie_guo_ji=mysql_query("select * from zi_fu_biao");
$mou_hang=mysql_fetch_array($jie_guo_ji);
$a=$mou_hang['zi_fu_da_xiao'];
$b=$mou_hang['zi_fu_jiao_du'];
$c=$mou_hang['zi_fu_heng_zhou_wei_zhi'];
$d=$mou_hang['zi_fu_zong_zhou_wei_zhi'];
$e=$mou_hang['zi_ti'];
$f=$mou_hang['zi_fu'];
$hua_bu= imagecreate(5120,4862);
imagecolorallocate($hua_bu, 255,255,255);
$qian_jing_yan_se=imagecolorallocate($hua_bu,0,0,0);
imagettftext($hua_bu,$a,$b,$c,$d,$qian_jing_yan_se,$e,$f);
header("content-type:image/png");
imagepng($hua_bu);
imagedestroy($hua_bu);
?>
我怀疑是数据引入,好像要使用$_GET[ ]
php gd函数不能与mysql一起使用
<?php
require '../../../../../public_file/database_connection.php';
$结果集=mysql_query("select * from 字符表");
$某行=mysql_fetch_array($结果集);
$a=$某行['字符大小'];
$b=$某行['字符角度'];
$c=$某行['字符横轴位置'];
$d=$某行['字符纵轴位置'];
$e=$某行['字体'];
$f=$某行['字符'];
?>
<img src="cha_kan_xiao_guo2.php?字符大小=<?php echo $a ?>&字符角度=<?php echo $b ?>&字符横轴位置=<?php echo $c ?>&字符纵轴位置=<?php echo $d ?>&
字体=<?php echo $e ?>&
字符=<?php echo $f ?>" alt=""/>
<?php
$画布 = imagecreate(5120,4862);
imagecolorallocate($画布, 255,255,255);
$前景颜色=imagecolorallocate($画布,0,0,0);
$a=$_GET['字符大小'];
$b=$_GET['字符角度'];
$c=$_GET['字符横轴位置'];
$d=$_GET['字符纵轴位置'];
$e=$_GET['字体'];
$f=$_GET['字符'];
imagettftext($画布,$a,$b,$c,$d,$前景颜色,$e,$f);
header("content-type:image/png");
imagepng($画布);
imagedestroy($画布);
?>
这两个文件合在一起可以运行