我希望更改标题页,以便爬虫可以看到它。
URL 的格式为:public.sample.com/account/Disney
我使用 require() 加载标准的全局标头包含文件
这是定义当前默认标签的地方。
如果 URL 是 public.sample.com/account/Disney,我希望读取标签:
这是迪士尼的帐户资料
我相信需要在这个全局头文件中写入一些内容,但不确定是什么。
Thanks.
超级简单的例子来帮助您入门。
<title><?php
if ( preg_match('/([^\/]+)\/([^\/]+)$/', $_SERVER['PHP_SELF'], $matches) ) {
list($dummy, $profileType, $profileName) = $matches;
$safeProfileType = htmlentities($profileType);
$safeProfileName = htmlentities ($profileName);
echo "This is an $safeProfileType profile for $safeProfileName";
} else {
echo "Unknown profile!";
}
?></title>
根据 Allin Lalonde 评论进行编辑。 (希望这就是他的意思)
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)