我正在访问WDSL网络服务而我只是想用HTML打印数据
$answer2 = $client->call('GetApplicationFields2', array('aToken' => ($aToken)));
print_r($answer2);
输出 - >
Array
(
[GetCurrentVacanciesResult] => Array
(
[string] => Array
(
[0] => 40|Developer
[1] => 56|Test
)
)
)
我想像
那样打印HTML<a href="40">Developer</a>
<a href="56">Test</a>
答案 0 :(得分:0)
您可以使用以下内容:
$answer2 = $client->call('GetApplicationFields2', array('aToken' => ($aToken)));
foreach($answer2['GetCurrentVacanciesResult'] as $key => $value) {
foreach($value as $s_key) {
$temp = explode('|', $s_key);
echo '<a href="'.$temp[0].'">'.$temp[1].'</a>';
}
}
结果:
<a href="40">Developer</a>
<a href="56">Test</a>
<a href="100">Some other value</a>
<a href="200">One more</a>
答案 1 :(得分:-1)
foreach( $answer2["GetCurrentVacanciesResult"]["string"] as $row ) {
$parts = explode( $row );
echo '<a href="' . $parts[0] . '">' . $parts[ 1 ] . '</a>';
}