문제

I am making a maintenance page and you can set maintenance to true in PHP like this:

$maintenance = false;

And I want a function to include on every page, like this

include 'example.php';
maintenance_mode();

And the function should re-direct the user to the maintenance page.

도움이 되었습니까?

해결책

   function isMaintenance($maintenance)
   {
     if(isset($maintenance) && $maintenance){
        header("location:maintenace_page.php");
        exit();
     }          
   }

In config.php add $maintenance variable,

  $maintenance =true;

and include isMaintenance($maintenance) function page and config page in respective page or if you already included any common file all the pages then use that file and add mentioned stuff into that page.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top