【发布时间】:2019-08-01 02:13:20
【问题描述】:
我的 IIS 站点上有 PHP 和 HTML 文件,并试图获取显示在同一页面上的表单的输出。我遇到的问题是当我加载 HTML 页面时,我看到数组信息在该页面上显示为纯文本。我已经定义了表单 action = ""。或者,当我定义了 form action = "file.php" 时,我得到了想要的结果,但是在一个新页面上。我查看了链接here,但似乎没有提供我想要的东西。我尝试在每一行上添加标签,这有点帮助,但我仍然将数组视为纯文本。这是我所拥有的:
<form action="" method = "POST">
MAC Address of phone: <input type="text" name="phonemac"><br><br>
<input type="submit" value="Check Phone Status">
</form>
<?php
$host = "server.com";
$username = "*****";
$password = "*****";
$context =
stream_context_create(array('ssl'=>array('allow_self_signed'=>true)));
$client = new SoapClient("C:\inetpub\wwwroot\PhoneSetup\AXLAPI.wsdl",
array('trace'=>true,
'exceptions'=>true,
'location'=>"https://".$host.":8443/axl",
'login'=>$username,
'password'=>$password,
'stream_context'=>$context
));
$response = $client->getPhone(array("name"=>"$_POST[phonemac]"));
$array = json_decode(json_encode($response), true);
echo $array['return']['phone']['description'];echo '<br><br>';
echo $array['return']['phone']['name']; echo;
?>
</body>
</html>
【问题讨论】: