まずtable
MarunouchisTable.php
<?php
namespace App\Model\Table;
use Cake\ORM\Table;
class MarunouchisTable extends Table
{
public function initialize(array $config)
{
$this->addBehavior('Timestamp');
}
}
?>
続いて、Viewのindex.ctp
<h1>丸の内の天気</h1> <ul> <?php foreach ($marunouchis as $marunouchi) : ?> <li><?= h($marunouchi->main); ?></li> <?php endforeach ; ?> </ul>
最後に、Controller
<?php
// /marunouchis/index
namespace App\Controller;
class MarunouchisController extends AppController
{
public function index()
{
$marunouchis = $this->Marunouchis->find('all');
$this->set(compact('marunouchis'));
}
}
?>
あら、いいですね。

index.ctpでtable表示してみます。
<h1>丸の内の天気</h1> <table> <tr> <?php foreach ($marunouchis as $marunouchi) : ?> <td width="150px"> <?= h($marunouchi->forecast); ?><br> <?= h($marunouchi->main); ?><br> <?= h($marunouchi->description); ?><br> <?= h($marunouchi->temp); ?><br> <?= h($marunouchi->humidity); ?><br> <?= h($marunouchi->speed); ?><br> </td> <?php endforeach ; ?> </tr> </table>
あら♪

ルーティングも/でMarunouchisのコントローラを呼び出すように変更します。
$routes->connect('/', ['controller' => 'Marunouchis', 'action' => 'index']);