PHP code example of gspgsp / weather
1. Go to this page and download the library: Download gspgsp/weather library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
gspgsp / weather example snippets
namespace App\Http\Controllers;
use Ggsspp\Weather\Weather;
class WeatherController extends Controller
{
//直接注入就可调用Weather类
public function index(Weather $weather)
{
//通过服务名称的方式调用
//dd(app('weather')->getWeather('天门市'));
//通过注入的方式访问
dd($weather->getWeather('天门市'));
}
}