คือผมดึงข้อมูล มาจาก การบริการข้อมูลอุตุนิยมวิทยาและแผ่นดินไหวผ่าน API แล้วต้องการจะใช้ข้อมูล เช่น จะแสดงชื่อจังหวัด, อุณภูมิต่ำสุด, อุณภูมิสูงสุด, ทิดทางลม, แรงลม แต่ไม่รู้จะนำออกมาใช้ยังไง เลยขอคำแนะนำหน่อยครับ
helper.php
โค้ด: เลือกทั้งหมด
class ModWeatherForcecastHelper
{
Public function getItems(){
$url = 'https://data.tmd.go.th/api/WeatherForecast7Days/V1/?type=json';
$data_url = file_get_contents($url);
return $data_url;
}
}
โค้ด: เลือกทั้งหมด
$helper = new ModWeatherForcecastHelper();
$product = $helper->getItems();
require(JModuleHelper::getLayoutPath('mod_weather_forcecast','default'));
โค้ด: เลือกทั้งหมด
<?php echo $product; ?>