【问题标题】:how to perform Android Call php function from server(10.0.2.2)?如何从服务器(10.0.2.2)执行 Android Call php 功能?
【发布时间】:2015-02-06 22:32:30
【问题描述】:

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

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

【问题讨论】:

    标签: php android


    【解决方案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(){
        ...
    }
    ?>
    

    【讨论】:

    • Uri uri = Uri.parse("10.0.2.2/sth.php?runFunction=true");如何设置用户名和密码。我的 php 函数位于带有一些用户名和密码的本地主机服务器中
    • 然后你 $_GET 用户名和密码变量并将它们与你的数据库或任何你调用的函数进行比较。
    • 你能给我一个示例代码什么的吗?我是业余爱好者
    • 这是一个很好的Tutorial。也不要忘记投票;)
    猜你喜欢
    • 2023-01-16
    • 1970-01-01
    • 2014-09-07
    • 1970-01-01
    • 1970-01-01
    • 2019-03-26
    • 1970-01-01
    • 2021-08-03
    • 1970-01-01
    相关资源
    最近更新 更多