小编Arc*_*ish的帖子

如何在 Android 中停止我的 VPN 服务?

我创建了一个应用程序 VPN 服务,它将阻止互联网数据包。一切工作正常,但现在我想通过按钮单击事件停止此 VPN 服务,以便数据包不再被阻止。

我尝试过使用stopService(name);stopSelf();

但什么也没发生。我究竟做错了什么?

public class VpnServiceCls extends VpnService  {
private Thread b;
private ParcelFileDescriptor c;
private PendingIntent a;
Builder builder = new Builder();

private static final String TAG = "VpnService";

@Override
  public void onDestroy() {
    // TODO Auto-generated method stub
    Log.d(TAG, "you are in jghbgjyhb");

    if (b != null) {
        Log.d(TAG, "you are in destroy2");
        b.interrupt();
    }

}

public void StopMyVPN()
{
    Log.d(TAG, "you are in jghbgjyhb 898");
    stopSelf();
    if (b != null) …
Run Code Online (Sandbox Code Playgroud)

service vpn android

3
推荐指数
1
解决办法
6925
查看次数

无法使用 file_get_contents('php://input') 检索原始帖子数据

这是我的代码。我正在使用 post 方法发布我的数据。

$post_body = file_get_contents('php://input');
if(getenv('REQUEST_METHOD') == 'POST'){
    print_r( array( "3","3d"));
}
print_r($post_body);
Run Code Online (Sandbox Code Playgroud)

我正在使用 chrome 的邮递员来测试此代码,但它不打印发布数据,请参阅输出图像。

输出图像

我做错了什么???

编辑

为了展示我如何解决我的问题,我添加了这张图片。

显示

php post file-get-contents postman

3
推荐指数
1
解决办法
5352
查看次数

标签 统计

android ×1

file-get-contents ×1

php ×1

post ×1

postman ×1

service ×1

vpn ×1