[PHP] Realize to enter information in the address bar

Seriously, I only know that $_GET can display data in the url. . . Others are not really understand


directly on the bar code

<?php
if(isset($_GET['number'])){
    
    
    foreach ($_GET as $num){
    
    
        $number = rand(1, 99);
        if($_GET == $number){
    
    
            echo "you got it";
        } else {
    
    
            echo "try again. The right answer is $number.<br>";
        }
}}else{
    
    
    echo 'no number.';
}

The display is like this. Insert picture description here
Then there is one point that controls the "variable" in the url, which is in parentheses after get. For example, change to

if(isset($_GET['num']))

In the address bar, you have to write num=how many.

Guess you like

Origin blog.csdn.net/qq_44899247/article/details/106146638