【问题标题】:Call php web service with url使用 url 调用 php web 服务
【发布时间】:2015-04-12 01:50:51
【问题描述】:

有没有像 asp.net web 服务那样使用 url 调用 php web 服务? 在 asp.net 网络服务中,我们可以使用 url 示例调用方法:

www.example.com/webservice.asmx?method=hello&name=world

【问题讨论】:

  • 当然。你必须编写 PHP 代码来做一些事情,但是像 www.example.com/webservice.php?method=hello&name=world 这样的东西在你编码后就可以正常工作。
  • 我假设你知道 apache2 是什么.....

标签: php asp.net web-services


【解决方案1】:

我猜你想做这样的事情:

<?php
function hello($arg) {
        echo "hello method : $arg";
}

function hello2($arg) {
        echo "hello2 method : $arg";
}

$method = $_GET['method'];
$name = $_GET['name'];

call_user_func($method, $name);
?>

【讨论】:

    猜你喜欢
    • 2012-05-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-09-09
    相关资源
    最近更新 更多