PHP: Detect Page Refresh

前端 未结 9 1481
余生分开走
余生分开走 2020-11-28 13:54

I have a page action.php on which I run an SQL query through the code, so that whenever the page is viewed the query runs like its like counting page vi

9条回答
  •  猫巷女王i
    2020-11-28 14:03

        //here you get the url behind the domain.
        $currentPage = $_SERVER['REQUEST_URI']; 
    
        //if the session current page is not set.
        if(!isset($_SESSION['currentPage'])){ 
    
          //set the session to the current page.
          $_SESSION['currentPage'] = $currentPage;     
        }
    
        //check if the session is not equal to the current page
        if($_SESSION['currentPage'] != $currentPage){
    
           // if it's not equal you set the session again to the current page.
           $_SESSION['currentPage'] = $currentPage;
    
           //set the query you want to use
        }
    

提交回复
热议问题