2016-06-16 4 views
0

Я начинаю php и начинаю изучать nusoap. Вот мой код:Результат NuSoap для строки PHP

<?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 ($ таблицы), я получил этот результат:

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 ($ таблицы, 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>

Пожалуйста, помогите. Благодарю.

ответ

0

Попробуйте

<?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>"; 

?> 
Смежные вопросы