Home > Software engineering >  change value of specified php file by url
change value of specified php file by url

Time:09-18

I want to change value of php file by URL request

for example we have this code in log.php file :

    <?php
    $my_log = "old.log";
    echo $my_log ;
    ?>

and this text will be output :

   old.log

so i want to call in browser url like this :

Http://localhost/log.php?my_log=new.log

and i want to get this output :

new.log

CodePudding user response:

<?php
$my_log = $_GET['my_log'] ?? 'old.log';
echo $my_log;
?>
  • Related