在JSON响应PHP中列出值
我目前正在使用亚马逊AWS SNS向客户发送短信 我只想显示一个下拉菜单,每个选项都包含在JSON响应PHP中列出值,php,json,Php,Json,我目前正在使用亚马逊AWS SNS向客户发送短信 我只想显示一个下拉菜单,每个选项都包含topicArn 当我做var\u dump($topics)时,我从收到的回复中尝试了以下内容:但是它不起作用 <div class="form-group"> <label for="exampleFormControlSelect1">Select list</label> <select clas
topicArn
当我做var\u dump($topics)时,我从收到的回复中尝试了以下内容:代码>但是它不起作用
<div class="form-group">
<label for="exampleFormControlSelect1">Select list</label>
<select class="form-control" name="selectList" id="selectList">
<?php
$topics = $sns->listTopics();
$test = $topics->get('Topics');
foreach($test['TopicArn'] as $topicArns)
{
echo '<option>'.$topicArns.'</option>';
}
?>
</select>
</div>
这个怎么样
foreach($test['Topics'] as $topic)
{
echo '<option>'.$topic['TopicArn'].'</option>';
}
foreach($test['Topics']作为$topic)
{
回显“.$topic['TopicArn']”;
}
这个怎么样
foreach($test['Topics'] as $topic)
{
echo '<option>'.$topic['TopicArn'].'</option>';
}
foreach($test['Topics']作为$topic)
{
回显“.$topic['TopicArn']”;
}