如何在PHP中动态获取页面标题

I am getting my main pages title but when it comes to getting inner pages (variable post) it's not working.

$path=$_SERVER['PHP_SELF'];
$page_title=basename($path);
switch($page_title){
    case 'index.php':
        $title="Welcome to the the website";
        $description="description goes here";
        break;
    case 'about.php':
        $title="Welcome to the the website";
        $description="somehtinfd";
        break;
    case 'career.php':
        $title="Welcome to the the website";
        $description="ome textr";
        break;   
    /*IT's NOT WORKING HERE*/
    case 'post.php?post_id=1':$title="graphics design services";
        $description= "about ";
        break;
}

I think you can use get().

case 'post.php':
    If($_GET["post_id"]== "1"){ 
        $title="graphics design services";
        $description= "about ";
    }elseif($_GET["post_id"]== "2"){

    }
    break;

So use case to get the page post, the use get to get the ID.

<title> <?php echo $title; ?> </title>
<meta type="description" content="<?php echo $description ?."</meta>