亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

完成企業(yè)官網(wǎng)前后臺小案例

Original 2019-07-23 01:48:39 423
abstract:<?php namespace app\index\controller; use app\admin\model\NewModel; use app\admin\model\ProductModel; use app\admin\model\SlideModel; use app\admin\model\SystemModel; use&n

2019-07-23_013922.jpg2019-07-23_014007.jpg2019-07-23_014050.jpg2019-07-23_014134.jpg2019-07-23_013823.jpg

<?php
namespace app\index\controller;
use app\admin\model\NewModel;
use app\admin\model\ProductModel;
use app\admin\model\SlideModel;
use app\admin\model\SystemModel;
use think\Controller;
use think\Facade\Request;

class Index extends Controller
{
    public function index()
    {
//        輪播圖查詢
        $slide= new SlideModel();
        $slides=$slide->select()->toArray();
        $this->view->slides=$slides;

//        最新產(chǎn)品查詢

        $product=new ProductModel();
        $products=$product->where('sort','1')->select()->toArray();
        $this->view->products = $products;

//        新上花魁
        $NewProducts=$product->where('sort','2')->limit(1)->select()->toArray();
        $this->view->NewProducts = $NewProducts;

//        最新資訊

        $new = new NewModel();
        $news=$new->limit(4)->select()->toArray();
        $this->view->news=$news;
        return $this->fetch();
    }

    public function about()
    {
//        關(guān)于我們
        $system=new SystemModel();
        $systems=$system->select()->toArray();
        $this->view->systems=$systems;
        return $this->fetch();
    }

    public function product()
    {
//        產(chǎn)品列表
        $product=new ProductModel();
        $products=$product->order('id','desc')->paginate(4);
        $this->view->products=$products;
        return $this->fetch();
    }

    public function news()
    {
        $new = new NewModel();
        $news=$new->order('id','desc')->paginate(4);
        $this->view->news=$news;
//        新聞列表

        $hotNews=$new->limit(1)->select()->toArray();
        $this->view->hotNews=$hotNews;


        $newNews=$new->limit(6)->select()->toArray();
        $this->view->newNews=$newNews;
        return $this->fetch();
    }

    public function ConNew()
    {
        $newId=Request::param('id');
        $new=NewModel::get($newId);
        $this->view->new=$new;

        $hotNew = $new->limit(1)->select()->toArray();
        $this->view->hotNews=$hotNew;

        $newNews=$new->limit(6)->select()->toArray();
        $this->view->newNews=$newNews;
        return $this->fetch();
    }

    public function ConPro()
    {
        $proId=Request::param('id');
        $product=ProductModel::get($proId);
        $this->view->product=$product;
        return $this->fetch();
    }
}


經(jīng)過本章節(jié)的練習,熟練掌握了thinkphp前端渲染技術(shù)。強大的框架大大方便了平時項目開發(fā)效率。后續(xù)不斷加強練習讓更加鞏固php開發(fā)技能

Correcting teacher:查無此人Correction time:2019-07-23 09:56:32
Teacher's summary:完成的不錯。多看thinkphp的文檔,多練習功能,很快就能上手。繼續(xù)加油。

Release Notes

Popular Entries