public function actionIndex() { // return is required $root = Yii::$app->params['root']; $typesModel = new \app\models\Types(); $types = $typesModel->find()->all(); require_once dirname(dirname(__FILE__)) . "/php/model/HomeImage.php"; $hi = new \HomeImage(); $imagesList = $hi->getRollImages(); return $this->render('index', ['info' => '123', 'types' => $types, 'imagesList' => $imagesList, 'typeHref' => $root . "index.php?r=oshjf/types&"]); }
$hi_modify = new HomeImage(); $id = $_POST["id"]; $iname = $_POST["iname"]; $href = $_POST["href"]; $rank = $_POST["rank"]; $hi_modify->setId($id); $hi_modify->loadById(); $hi_modify->setIname($iname); $hi_modify->setHref($href); $hi_modify->setRank($rank); $hi_modify->update(); header("location:homeImagesController.php"); exit; } $hi = new HomeImage(); $list = $hi->getRollImages(); echo "\n <table class='table'>\n <thead>\n <th>编号</th>\n <th>名称</th>\n <th>图片</th>\n <th>跳转链接</th>\n <th>添加时间</th>\n <th>优先级(优先级高的排在前面显示)</th>\n <th>操作</th>\n </thead>\n"; foreach ($list as $one) { ?> <tr> <td><?php echo $one->getId(); ?> </td> <td><?php echo $one->getIname(); ?> </td> <td><img src="<?php echo $one->getUrl(); ?>