在devicesController中,我使用的是cakephp2.7
<?php
class DevicesController extends AppController {
public function index() {
$devices = $this->Device->find('all');
$mymoo=$this->set('mymoo', $this->Device->find('all'));
}
}
?>
在Device / index.ctp中,我的数据已经存储了数据库,
<html>
<body>
<?php foreach ($mymoo as $value): ?>
<div class="iotsensors">
<div class="container">
<p> <?php echo $value['Device']['mac_address']; ?></p>
</div>
</div>
<?php endforeach; ?>
<?php unset($value); ?>
</body>
</html>