What is the function of a parameter when PHP creates a verification code?
$x =rand (1,8) + $imagewidth * $i/4;
$y =rand (1, $imageheight/4);
In this circular statement, what is the function of seeking $num?
Because the imagestring () function works: Adds a number to the image. I think that $num is definitely used to limit the number of digits added to the image,
But change $num=4, $num =15 or other numbers, the image still shows 4 characters.
And I would like to ask weakly weak, through post and get pass parameters, such as login?id=2&value=3, this id,value through
$_post or $_get gets, the value of ID and value is an integer or a character!
Do not want to verify, too troublesome, on the Warrior advice!!! PHP Verification Code $_post[]
Share to:
------Solution--------------------
The first question. Do you try $num=2 or four numbers?
$x calculation means only four digits are displayed
The second question I do not know whether it is a character or an integer expecting an expert to answer, but can be when the word trailing characters can also be used as an integer this is the charm of PHP
------Solution--------------------
The first one to see upstairs.
A second string
------Solution--------------------
Your picture width is fixed ...
------Solution--------------------
$x =rand (1,8) + $imagewidth * $i/4;
It's clear that you can adjust the writing order.
$x = $imagewidth/4 * $i + rand (1,8);
which
$imagewidth/4 Divide the width of the canvas into 4 points
$imagewidth/4 * $i The beginning of the first $i character on the canvas
Rand (1,8) lets the starting position be shifted to several points
When the number of characters exceeds 4, there is no limit, just the calculated position outside the canvas. Painted and painted in white.
------Solution--------------------
reference:
Quote: reference:
$x =rand (1,8) + $imagewidth * $i/4;
Adjust the order of writing is clear
$x = $imagewidth/4 * $i + rand (1,8);
Where:
$imagewidth/4 The width of the canvas is divided into 4 points
$imagewidth/4 * $i The first $i characters on the canvas start position
rand (1,8) to have the starting position shifted to a few points
When the number of characters exceeds 4, there is no limit, just the calculated position outside the canvas. Draw also white draw
seems to be a little understanding, with the question, if you want to generate random code containing letters and numbers, how should be rewritten?
Hope Big Brother