我想要像一個反垃圾郵件系統,我有這個HTML:PHP rand()函數
What is <?php echo $six; ?> + <?php echo $rand1; ?> <input type="text" name="human" id="human">
而對於這些變量:
$human = @$_POST['human'];
$rand1 = rand(1, 9);
$six = 6;
$res = $rand1 + $six;
然後我做的:
if($human==$res){
echo "Correct";
}else{
echo "Incorrect";
}
這不行!有任何想法嗎?
是你在調用'rand(1,9)'的同一個php文件的html代碼的一部分嗎? – vee
你必須存儲正確的值。 –
@vinodadhikary是的,它是 –