PHP Script Version Checking/Notification

后端 未结 4 1045
情歌与酒
情歌与酒 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:43

    Per comments on this answer

    // Substitue path to script with the version information in place of __FILE__ if necessary
    $script = file_get_contents(__FILE__);
    $version = SOME_SENSIBLE_DEFAULT_IN_CASE_OF_FAILURE;
    if(preg_match('//', $script, $version_match)) {
        $version = $version_match[1];
    }
    

提交回复
热议问题