Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
后端现在不支持我以前的版本之一。所以,我想获取调用服务器的应用程序的版本代码/名称,以便服务器可以做出相应的响应。
在以后的版本中,我将使用标题来实现这一点。像这样:
httppost = new HttpPost(url); httppost.setHeader("version", "10");
但是任何方法都可以在服务器端获取版本而无需设置标头,只需从 apk 的清单中即可。
我PHP在后端使用。
PHP
谢谢你
可惜没有,
HttpPost 旨在仅包含您提供的标题和数据,它不会自动添加任何内容。
您可以在新版本中添加该标头,以防标头丢失(从服务器端 PHP 脚本检查时)然后拒绝访问或要求用户安装新版本。