PHP code example of lostcontrols / weather

1. Go to this page and download the library: Download lostcontrols/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/ */

    

lostcontrols / weather example snippets


<response>
    <status>1</status>
    <count>1</count>
    <info>OK</info>
    <infocode>10000</infocode>
    <lives type="list">
        <live>
            <province>湖南</province>
            <city>长沙市</city>
            <adcode>440300</adcode>
            <weather>中雨</weather>
            <temperature>27</temperature>
            <winddirection>西南</winddirection>
            <windpower>5</windpower>
            <humidity>94</humidity>
            <reporttime>2018-08-21 16:00:00</reporttime>
        </live>
    </lives>
</response>

    .
    .
    .
    public function edit(Weather $weather) 
    {
        $response = $weather->getWeather('长沙');
    }
    .
    .
    .

    .
    .
    .
    public function edit() 
    {
        $response = app('weather')->getWeather('长沙');
    }
    .
    .
    .