我需要使用 SODA Api 提取所有列标题。
我没有找到使用 API 的解决方案,所以我创建了这段代码。但在某些情况下,列的标题与列 api 名称不同......
有更好的解决方案吗?
//return the Dataset Columns Header
public function getDatasetColumnsHeader($dataset) {
$file = "https://www." . $this->root_url . "/resource/" . $dataset . ".csv";
$f = fopen($file, 'r');
$line = fgets($f);
fclose($f);
return explode(",", $line);
}