【发布时间】:2014-11-30 12:35:58
【问题描述】:
我必须在我的网站上找到一张桌子。并且必须从中获取该表的数据 “http://west.basketball.nl/db/json/stand.pl?szn_Naam=2014-2015&cmp_ID=373” 我已经尝试了很多东西,但没有任何效果......
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript"
src="http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
</head>
<body>
<?php
$json=file_get_contents("http://west.basketball.nl/db/json
/stand.pl?szn_Naam=2014-2015&cmp_ID=373");
$data = json_decode($json);
if (count($data)) {
// Open the table
echo "<table>";
// Cycle through the array
foreach ($data as $stand) {
// Output a row
echo "<tr>";
echo "<td>$afko</td>";
echo "<td>$positie</td>";
echo "</tr>";
}
// Close the table
echo "</table>";
}
?>
</body>
</html>
【问题讨论】:
-
对不起各位...忘了说,但这是写在一个.php文件中
-
什么不起作用?您是否在开发环境中将
error_reporting设置为E_ALL和display_errors设置为on? -
你是什么意思?....我猜不是....对php来说还是新手
-
我想问题是由于安全原因 url_fopen 被设置为禁用。在 PHP 脚本的开头添加
error_reporting(E_ALL);。并确保在您的 .htaccess 或 php.ini 中将display_errors设置为On或在您提出请求后查看 PHP 日志文件。 -
我不知道 php.ini 是什么,也不知道 .htaccess 是什么......,我确实添加了错误报告,但它仍然不起作用。控制台有一个错误,它关于 html 的绘图集以及它是如何未声明的以及关于 US-ASCCI 什么的?
标签: php html json html-table