亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

如何獲得結果 (JSON PHP)

如何獲得結果 (JSON PHP)

PHP
墨色風雨 2021-09-18 20:17:57
我有個問題。我怎樣才能得到結果?這是我的代碼:<?php $api_e = file_get_contents('https://omnihost.tech/dashboard/hosts/'.$slug.'/api_ftp');$api = json_decode($api_e); ?><?php foreach($api as $file){ ?>    <tr>        <td>#</td>        <td><?= $file; ?></td>        <td>--</td>    </tr><?php } ?>我的 JSON 是:{"data": [".","..",".editorconfig",".gitignore",".htaccess",".well-known","README.md","application","assets","cgi-bin","composer.json","contributing.md","index.php","license.txt","readme.rst","system"]}錯誤:http : //prntscr.com/o98xau
查看完整描述

2 回答

?
12345678_0001

TA貢獻1802條經驗 獲得超5個贊

您需要指定您需要打印的列,您可以嘗試在下面打印文件名


<td><?= $file['12']; ?></td>


否則,您將循環打印數組中的所有數據,使用 2 個循環



<?php foreach($api as $file) { ?>

<?php foreach($file as $i => $item) { ?>

<tr>

<td><?= $i; ?></td>

<td><?= $item; ?></td>

<td>--</td>

</tr>

<?php } ?>

<?php } ?>


查看完整回答
反對 回復 2021-09-18
  • 2 回答
  • 0 關注
  • 169 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號