在php中,只能从random中添加整数
我正在用php进行锻炼,现在我面临一个问题 我的php代码是:在php中,只能从random中添加整数,php,Php,我正在用php进行锻炼,现在我面临一个问题 我的php代码是: <?php $random= rand (1,5)."Boys"; $random2= rand (1,5)."Girls"; $random3=$random.$random2; imagettftext($jpg_image, 25, 0, 10,20, $white, $font_path, $random); imagettftext($jpg_image
<?php
$random= rand (1,5)."Boys";
$random2= rand (1,5)."Girls";
$random3=$random.$random2;
imagettftext($jpg_image, 25, 0, 10,20, $white, $font_path, $random);
imagettftext($jpg_image, 25, 0, 100,200, $white, $font_path, $random2);
imagettftext($jpg_image, 25, 0, 275, 50, $white, $font_path,$random3);
?>
我还没有给出完整的编码,但我会向你们解释这个概念,我得到的是随机数和一个固定的文本,就像现在在
$random3
中的男孩或女孩一样,我只想显示整数的和,它是由$random
和$random2
随机给出的,所以请帮帮我 php文件中需要进行一些编辑
<?php
$random= rand (1,5)."Boys";
$random2= rand (1,5)."Girls";
$random3=($random+$random2);
imagettftext($jpg_image, 25, 0, 10,20, $white, $font_path, $random);
imagettftext($jpg_image, 25, 0, 100,200, $white, $font_path, $random2);
imagettftext($jpg_image, 25, 0, 275, 50, $white, $font_path,$random3);
?>
现在它可以正常工作了。我已经改正了