Home > Article > Backend Development > Javascript and PHP verify whether the URL address entered by the user is correct, javascripturl_PHP tutorial
The example in this article describes the method of using Javascript and PHP to verify whether the URL address entered by the user is correct. It is shared with everyone for your reference. The specific method is as follows:
1.javascript detects URL address validity:
2.PHP detects URL address validity
If you want to try to see if it works normally, we can use the file_get_contents() function to verify.
I hope this article will be helpful to everyone’s PHP programming design.
Verification codes are generally generated randomly on the server. Use ajax to obtain the verification code on the html page and compare it with the verification code entered by the user.
< a href="document.getElementById('img_auth_code').src='auth_code.php?code='+Math.random();">Can’t see clearly, please change another one
//This page is used to randomly obtain the verification code rand_auth_code.php
function get_auth_code()
{
for($i=0;$i<5;$i++ )
{
$_GLOBALS['rand_str'].=strtoupper(dechex(rand(0,15)));
rand_str_width+=imagefontwidth($i);
}
}
echo $_GLOBALS['rand_str'];
?>
include_once("rand_auth_code.php");//Import the page that generates the verification code
$img_width=100;
$img_height=25;
$img=imagecreatetruecolor($img_width,$img_height);
$img_bg_col...The rest of the text>>
Is there a problem with the page connecting to the database? I suggest you try another method