How can a config.php file be used to implement a page lock feature in PHP?

To implement a page lock feature in PHP using a config.php file, you can define a variable in the config.php file that specifies whether the page should be locked or not. Then, in the PHP file where you want to implement the page lock feature, include the config.php file and check the value of the variable to determine if the page should be locked or not.

// config.php
<?php
$lockPage = true; // Set to true to lock the page, false to unlock
?>

// locked_page.php
<?php
include 'config.php';

if($lockPage){
    echo "This page is locked. Access denied.";
    exit;
}else{
    // Page content here
}
?>