简体   繁体   English

根据URL字符串显示内容

[英]Display content based on URL string

Here's the scenario, upon successfully installing our software, we launch your web browser and display a thank you page. 在这种情况下,成功安装我们的软件后,我们将启动您的Web浏览器并显示“谢谢”页面。

I'm trying to figure out how to display an additional block of html that notifies the user if they've just installed an older version and provides a download link to the latest. 我试图弄清楚如何显示额外的html块,以通知用户是否已安装旧版本并提供最新版本的下载链接。

Upon install, an older version would display something like this: www.oursite.com/thanks/?v=2.2.0 安装后,旧版本将显示以下内容:www.oursite.com/thanks/?v=2.2.0

While the current version should generate something like this www.oursite.com/thanks/?v=3.0.0.20932 虽然当前版本应生成类似以下内容的内容,但www.oursite.com/thanks/?v=3.0.0.20932

(They both bring you to the same page, just have a different token) (它们都将您带到同一页面,只是具有不同的令牌)

I've considered adding redirects to our .htaccess -but we've released many incremental versions and that could get messy quick. 我已经考虑过将重定向添加到.htaccess-但我们已经发布了许多增量版本,可能很快就会变得混乱。

We're running wordpress - so php or js should work fine, i just don't have the programming chops for something like this and don't even know where to begin. 我们正在运行wordpress-所以php或js应该可以正常工作,我只是没有像这样的东西的编程印章,甚至不知道从哪里开始。

You could simply compare the version string with a "latest version" constant that you would update manually. 您可以简单地将版本字符串与要手动更新的“最新版本”常量进行比较。

<?php
    define(LATEST_VERSION, "3.0.0.20932");

    if ($_GET['v'] != LATEST_VERSION)
        echo "<p>You don't have the latest version.</p>";
?>

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

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