从Java传递字符串变量PHP函数

问题描述:

我是初学者Java和PHP
我必须使用的WebView从Java客户端一个字符串变量传递给PHP服务器

I am a beginner java and php I must pass a string variable from Java client to php server using WebView

是我在做什么吧?

在Java方面:

String Coords=CoordsString;
String PHPPagePath="http://10.0.2.2/ReceiveLocation.php?Coords=" + CoordsString"; 

和在PHP端:
ReceiveLocation.php

and on the php side: ReceiveLocation.php

 <?php
include('ConnectionFunctions.php');
Connection(); 
$x=$_GET['Coords'];
GetCoords($x);
function GetCoords($x)
{
   echo $x;
}   
?>

这是从Java客户端的参数COORDS传递给PHP服务器功能的正确方法?

Is this the right way to pass the parameter Coords from Java Client to PHP Server Function?

修改您的code如下

Java的code:

Java code:

String Coords=CoordsString;
String PHPPagePath="http://10.0.2.2/ReceiveLocation.php?Coords=10";

PHP code:

PHP code:

<?php
include('ConnectionFunctions.php');
Connection(); 

function GetCoords(x)
{
echo 'Coords = '.$_GET['Coords'];

}   
?>