简体   繁体   中英

Before starting php echo a message and activate button?

How do I activate stages of php, for example the user opens the php file. And before starting the script they are asked "are you sure you want to continue". With a button below staying activate.

I have already looked around and I'm sure there is a way to do it but I don't know what it is called. Could someone help me out?

.Short way to do that:

if($_GET['execute'] == 'yeah') {
    // your php-file-content goes here....
    // ....
} else {
    echo '<a href="'.$_SERVER["PHP_SELF"].'?execute=yeah">Are you sure you want to execute this file?</a>'.PHP_EOL;
}

Just put your filecontent between the IF part. It wont be executed untill the request ist yourfilename.php?execute=yeah

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM