我想根据重定向的页面更改DIV中的文本。
如果有条件的话。或者任何帮助我做这件事的代码..。搜索了所有的网络。但没有找到:
如果用户减少来自google.com的人,我想向谷歌人问好!如果他来自我的朋友网站,你好,xxx读者。(Xxx = my friends blog name)。如果他是直接来访者,你好啊。像这样..。
希望你们能帮我!谢谢!!
更新
在堆栈溢出中的其他问题中,我发现这个ode (ASP.NET)在php中需要一个类似的代码。
在这个ASP代码中,他编写了ENDS WITH(" "),但我想在那里编写完整的url。
protected void Page_Load(object sender, EventArgs e)
{
string requestUrl = "";
. . .
if (requestUrl.ToString().EndsWith("Page1.aspx"))
label.Text = "foo";
else
label.Text = "bar";
}谢谢!
发布于 2013-05-17 04:06:13
$_SERVER['HTTP_REFERER']将完全满足您的需要。
if (strstr($_SERVER['HTTP_REFERER'], 'facebook.com') !== false) {
// Facebook brought me to this page.
}
else if (strstr($_SERVER['HTTP_REFERER'], 'google.com') !== false ) {
// Google brought me to this page.
}编辑
else if (strstr($_SERVER['HTTP_REFERER'], 'xxx.blogspot.com') !== false ) {
// Your friend brought me to this page.
}https://stackoverflow.com/questions/16601183
复制相似问题