PHP

url 주소로 경로 판단

헤롱헤롱이 2020. 6. 9. 14:37
if(!empty($_SERVER['SCRIPT_NAME']))
{
    $cls = array();
    if(strpos($_SERVER['SCRIPT_NAME'], "/register_form"))
    {
        $cls[0] = "active";
    }
   
    if(strpos($_SERVER['SCRIPT_NAME'], "/pay"))
    {
        $cls[1] = "active";
    }
   
    if(strpos($_SERVER['SCRIPT_NAME'], "/pushing"))
    {
        $cls[2] = "active";
    }
   
    if(strpos($_SERVER['SCRIPT_NAME'], "/point"))
    {
        $cls[3] = "active";
    }
   
}