public function jsonRPCAct() { vendor('jsonRPC.jsonRPCClient'); $client = new \jsonRPCClient('http://localhost:8500/Api/JsonRPCTest'); $result = $client->test(); var_dump($result); // 结果: }
<?php require_once "jsonRPCClient.php"; try { $url = "http://localhost/minga/index.php?q=mingapi"; $api = new jsonRPCClient($url, true); $api->login("bison", "45fisser"); $res = $api->test(); echo "Reply from server: {$res}\n"; } catch (Exception $e) { echo "Der opstod en fejl.\n"; //print_r($e); }