How can the $_GET superglobal be used to pass information about the file to be deleted in PHP?

To pass information about the file to be deleted using the $_GET superglobal in PHP, you can include the file name as a parameter in the URL and retrieve it using $_GET['filename']. This way, you can dynamically delete the specified file based on the parameter passed in the URL.

<?php
if(isset($_GET['filename'])){
    $filename = $_GET['filename'];
    if(file_exists($filename)){
        unlink($filename);
        echo "File $filename has been deleted.";
    } else {
        echo "File $filename does not exist.";
    }
} else {
    echo "No file specified for deletion.";
}
?>