从Java传递字符串变量PHP函数 [英] Pass string variable from java to php function
本文介绍了从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'];
}
?>
这篇关于从Java传递字符串变量PHP函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文