PHP Web服务多个数据传递?

时间:2016-12-19 20:12:00

标签: php web-services dataset resultset

我目前正在尝试使用PHP Web服务从Access数据库接收结果集。我目前的代码是函数/ web-method的脚本:

require_once "lib/nusoap.php";

class food 
{
 public function getFood() 
 {
    $MyDb = realpath("WEBSERVICES/db/Database.mdb");
    $connect = new COM("ADODB.Connection") or die("Cannot start ADO.");
    $connStr = "Provider=Microsoft.jet.OLEDB.4.0;Data Source=$MyDb";
    $connect->Open($connStr);

    $sql = "select all the stuff needed the query works fine";

    $result = $connect->Execute($sql);

    $resultslist = (
    $Routecode = $result->Fields['RouteCode']->Value &
    $Route = $result->Fields['Route']->Value &
    $StationName = $result->Fields['StationName']->Value &
    $Platform = $result->Fields['Platform']->Value &
    $ArrivalTime = $result->Fields['ArrivalTime']->Value &
    $Departure = $result->Fields['Departure']->Value &
    $Status = $result->Fields['Status']->Value
    );

    return $resultslist;
    }
 }

 $server = new soap_server();
 $server->configureWSDL("foodservice", "http://the site");

 $server->register("food.getFood",
 array("type" => "xsd:string"),
 array("return" => "xsd:string"),
 "http:// the site /food",
 "http://the site /food#getFood",
 "rpc",
 "encoded",
 "Get food by type");

 @$server->service($HTTP_RAW_POST_DATA);

以及调用该函数的第二个脚本:

require_once "lib/nusoap.php";
$client = new nusoap_client("MY.WSDL.FILE", true);

$result = $client->call("food.getFood");
echo $result;

我可以显示一条数据,但是如果我尝试使用$ resultlist中显示的数据,那么它会显示" 0"如果我重新排列列表,我有时会从列表中获取其中一个项目的单个数据,奇怪我知道。所以我的问题是,如何传递所有数据,类似于VB.net数据集/数据表等?

0 个答案:

没有答案