gpt4 book ai didi

PHP 脚本版本检查/通知

转载 作者:可可西里 更新时间:2023-11-01 12:44:50 24 4
gpt4 key购买 nike

我如何根据在线文件检查我的脚本版本以查看它是否是最新版本?

为澄清起见,我说的是我编写的脚本,而不是 PHP 版本。我想合并一种方式让最终用户知道我何时更新了脚本。

最佳答案

指定第二个(更简单的)解决方案phjr建议:

在您自己的公共(public)服务器上有一个文件 version.txt 并将以下函数包含到您部署的项目/脚本中:

define('REMOTE_VERSION', 'http://your.public.server/version.txt');

// this is the version of the deployed script
define('VERSION', '1.0.1');

function isUpToDate()
{
$remoteVersion=trim(file_get_contents(REMOTE_VERSION));
return version_compare(VERSION, $remoteVersion, 'ge');
}

version.txt 应该只包含最新的版本号,例如:

1.0.2

关于PHP 脚本版本检查/通知,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/236070/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com