PHP implementation is similar to the alert () prompt box in js, jsalert. PHP implementation is similar to the alert () prompt box in js. jsalert is mainly used to add judgment prompts, jump, return, and refresh. The code for copying the code is as follows: *** JS prompt jump * @ param $ tip pop-up window PHP implementation is similar to the alert () prompt box in js, jsalert
It is mainly used to add judgment prompts, jump, return, and refresh.
The code is as follows:
/**
* JS prompt jump
* @ Param $ tip prompt message in the pop-up window (blank, no prompt)
* @ Param $ type the setting type is close = close, back = return, refresh = prompting for heavy load, jump prompting and jump to url
* @ Param $ url jump url
*/
Function alert ($ tip = "", $ type = "", $ url = ""){
$ Js = "script";
If ($ tip)
$ Js. = "alert ('". $ tip ."');";
Switch ($ type ){
Case "close": // close the page
$ Js. = "window. close ();";
Break;
Case "back": // return
$ Js. = "history. back (-1 );";
Break;
Case "refresh": // refresh
$ Js. = "parent. location. reload ();";
Break;
Case "top": // exit the framework
If ($ url)
$ Js. = "top. location. href = '". $ url ."';";
Break;
Case "jump": // jump
If ($ url)
$ Js. = "window. location. href = '". $ url ."';";
Break;
Default:
Break;
}
$ Js. = "script";
Echo $ js;
If ($ type ){
Exit ();
}
}
The above is all the content of this article. I hope it will help you learn php.
Http://www.bkjia.com/PHPjc/969491.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/969491.htmlTechArticlePHP implementation similar to js in the alert () prompt box, jsalert is mainly used to add judgment prompt, jump, return, refresh. The code is as follows:/*** JS prompts jump * @ param $ tip to pop up the window...