【发布时间】:2017-06-08 19:02:00
【问题描述】:
我正在获取我的主页标题,但在获取内页(可变帖子)时它不起作用。
$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;
}
【问题讨论】:
-
$_SERVER['PHP_SELF'] 不返回 url 的查询字符串。仅尝试使用文件名 post.php
-
'post.php?post_id=1'— 您是否查看过要与之比较的$page_title的值? -
嘿兄弟我怎样才能得到这种类型的值
-
@manian 嘿兄弟,我怎样才能得到 url 的查询字符串