【发布时间】:2020-01-20 06:28:08
【问题描述】:
下面是我的 JSON 结果
当我想将“factoryList”填充到 PHP 下拉列表中时,我得到了奇怪的结果。下面是结果
以下是我当前的php代码:
<!DOCTYPE html>
<html lang="en">
<?php
$url = 'http://172.20.0.45/TGWebService/TGWebService.asmx/factoryList'; // path to your JSON file
$data = file_get_contents($url); // put the contents of the file into a variable
$characters = json_decode($data); // decode the JSON feed
foreach ($characters->factoryList as $character) {
echo '<select class="form-control" name="Fac_ID" class="form-control">';
echo "<option value='$character->facID'>$character->facName</option>";
echo "</select>";
}
?>
</html>
谁能帮忙解决这个问题?
【问题讨论】:
-
请重复选项标签而不是选择标签。
标签: php json sql-server