如何从服务器(10.0.2.2)执行Android Call php功能?

时间:2014-12-09 05:29:49

标签: php android

参考此链接open a url on click of ok button in android

我想通过构建器按钮在我的xampp服务器中调用php函数,单击“确定”

1 个答案:

答案 0 :(得分:1)

Uri uri = Uri.parse("10.0.2.2/sth.php?runFunction=true");
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);

PHP:

<?php 
if($_GET["runFunction"] == true){
    myFunction();
}

function myFunction(){
    ...
}
?>