首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >结果NuSoap字符串

结果NuSoap字符串
EN

Stack Overflow用户
提问于 2016-06-16 22:55:22
回答 1查看 182关注 0票数 0

我是php初学者,开始学习nusoap。这是我的代码:

代码语言:javascript
复制
<?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),就会得到以下结果:

代码语言:javascript
复制
    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),但结果是空白白页。

我想要这样的输出:

代码语言:javascript
复制
<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>

请帮帮忙。谢谢。

EN

回答 1

Stack Overflow用户

发布于 2016-08-15 07:14:03

试一试

代码语言:javascript
复制
<?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>";

?> 
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/37870662

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档