2016-06-16 2 views
0

나는 PHP 초보자이며 학습을 시작할 수 있습니다. 내 코드는 다음과 같습니다.결과 NuSoap to String 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 
       ) 
    ) 
) 

나는 값을 인쇄하려면이 코드를 사용하는 경우 : (TRUE $ 테이블) 에서 print_r하지만 결과를 빈 흰색 페이지입니다.

이 같은 출력을 싶습니다

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

?>