PHP Script Version Checking/Notification

后端 未结 4 1041
情歌与酒
情歌与酒 2021-02-04 17:08

How can I check the version of my script against an online file to see if it\'s the latest version?

For clarification, I\'m talking about a script I wrote, not the v

4条回答
  •  礼貌的吻别
    2021-02-04 17:40

    define('REMOTE_VERSION', 'http://your.public.server/version.txt');
    define('VERSION', '1.0.1');
    $script = file_get_contents(REMOTE_VERSION);
    $version = VERSION;
    if($version == $script) {
        echo "

    You have the latest version!

    "; } else { echo "

    There is a update available!

    "; }

提交回复
热议问题