我迷路了。我正在努力为我的lotto.php随机数字。第一个是我的HTML:
<textarea name="ticket" rows="20" cols="20"></textarea>
如何将“票证”带到标准的php格式?
// Set the min/max
$numbers = array_fill(1,47,0);
// array-slice
$numbers = range(1, 47);
shuffle($numbers);
$numbers = array_slice($numbers, 0, 6);
print_r($numbers);
另外,我也必须有$ _POST。
答案 0 :(得分:1)
利用PHP的implode()
<?php
$numbers = array_fill(1,47,0);
// array-slice
$numbers = range(1, 47);
shuffle($numbers);
$numbers = array_slice($numbers, 0, 6);
//print_r($numbers);
$lottonum = implode(" ", $numbers); // Space as seperator
echo $lottonum;
输出:
45 24 6 25 17 28