我是php初学者,开始学习nusoap。这是我的代码:
<?php
include_once('nusoap/nusoap.php');
include_once('nusoap/class.wsdlcache.php');
$url = 'http://localhost:8082/ws/server.php?wsdl';
$client = new nusoap_client($url, true);
$proxy = $client->getProxy();
$username = 'admin';
$password = 'admin123';
$token = $proxy->GetToken($username, $password);
//this code to display ListTable
$table = $proxy->ListTable($token);
?>如何显示表的列表?如果我尝试使用以下代码:print_r($table),就会得到以下结果:
Array
(
[error_code] => 0
[error_desc] =>
[result] => Array
(
[0] => Array
(
[table] => student
[category] => Ref
[information] => student information
)
[1] => Array
(
[table] => id_number
[category] => Ref
[information] => Student ID Number
)
[2] => Array
(
[table] => Address
[category] => Ref
[information] => Student Address
)
)
)如果使用此代码打印值:print_r($table,TRUE),但结果是空白白页。
我想要这样的输出:
<table border='1'>
<tr>
<td>Table</td>
<td>Category</td>
<td>Information</td>
</tr>
<tr>
<td>student</td>
<td>Ref</td>
<td>student information</td>
</tr>
<tr>
<td>id_number</td>
<td>Ref</td>
<td>student id number</td>
</tr>
<tr>
<td>information</td>
<td>Ref</td>
<td>student address</td>
</tr>
</table>
请帮帮忙。谢谢。
发布于 2016-08-15 07:14:03
试一试
<?php
echo "<table><tr>";
foreach($table['result'] as $r){
echo "<td>".$r['table']."</td>";
echo "<td>".$r['category']."</td>";
echo "<td>".$r['information']."</td>";
}
echo "</tr></table>";
?> https://stackoverflow.com/questions/37870662
复制相似问题