简体   繁体   English

为来自网站上特定页面的用户显示消息的最佳方法?

[英]Best way to display a message for users that came from a specific page on the website?

I have a quick question on the best way to show a particular message to users that navigated to a page via a particular link on the site. 我想对通过网站上特定链接向导航到页面的用户显示特定消息的最佳方式提出一个快速问题。

The situation is I have a sidebar on the website and two of the links will point to the same page - one of them used to point to a page containing a form but now I want to change it to point to the same page as another link and display a message for users that clicked this particular link. 情况是我在网站上有一个侧边栏,并且两个链接将指向同一页面-其中一个曾经用于指向包含表单的页面,但是现在我想将其更改为指向与另一个链接相同的页面并为单击该特定链接的用户显示一条消息。

I tried changing the htaccess file and using HTTP_REFERER but because theses links are in a sidebar on every page that doesn't work - never thought that one through at the time! 我尝试更改htaccess文件并使用HTTP_REFERER但因为这些链接都在无法正常工作的每个页面的侧栏中-从来没有想过那个时候!

Now I have tried simply changing the link and adding a parameter on the end, eg /page.html?question=yes and then doing the following on the page: 现在,我尝试仅更改链接并在最后添加参数,例如/page.html?question=yes ,然后在页面上执行以下操作:

if ($_GET['question'] == 'yes')
{
    echo '..................';  
}

But that doesn't seem to be working either so I was wondering if anyone had came accross a similar problem and how they went about solving it? 但这似乎也不起作用,所以我想知道是否有人遇到过类似的问题,以及他们如何解决这个问题?

Using $_GET and Querystring is the best match for you, but I'm not sure your file extension is being processed properly. 使用$ _GET和Querystring最适合您,但我不确定您的文件扩展名是否得到正确处理。 Try to change .html to .php 尝试将.html更改为.php

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM