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

搜索
博主信息
博文 41
粉絲 2
評(píng)論 0
訪問量 36615
最新下載
更多>
網(wǎng)站特效
網(wǎng)站源碼
網(wǎng)站素材
前端模板
TP6之分頁實(shí)戰(zhàn)
月光下,遺忘黑暗
原創(chuàng)
1425人瀏覽過

控制器代碼

<?phpnamespace app\controller;use app\BaseController;use think\facade\Db;class Index extends BaseController{    public function index()    {        $name = input('get.name','');        $search = input('get.t','');        $data['cat'] = Db::name('cat')->where('status',1)->order('sort desc')->select();        if(!empty($name)) {            $data['select'] = Db::name('boke')->where('cat',$name)->order('date desc')->paginate(5);        } else if(!empty($search)){            $data['select'] = Db::name('boke')->whereLike('title',"%$search%")->order('date desc')->paginate(5);        } else {            $data['select'] = Db::name('boke')->order('date desc')->paginate(5);        }        return view('index',$data);    }}

視圖代碼

<!DOCTYPE html><html lang="zh-CN"><head>    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />    <title>首頁 - 歐陽克個(gè)人博客</title>    <meta name="keywords" content="博客,個(gè)人博客,歐陽克個(gè)人博客,PHP"/>    <meta name="description" content="歐陽克是PHP中文網(wǎng)的講師,愿意把知識(shí)分享給大家。" />    <link rel="stylesheet" id="twentytwelve-style-css" href="static/css/index.css" type="text/css" media="all" />    <style type="text/css" id="custom-background-css">        body.custom-background {background-color:#e6e6e6;}        input.btn-default:focus,input.no-border:focus {outline:none;}        input.no-border {font-size:15px;}    </style>    <script type="text/javascript" src="static/js/jquery.js"></script>    <script type="text/javascript" src="static/js/nav.js"></script></head><body class="home blog custom-background custom-font-enabled single-author">    <div id="page" class="hfeed site">        <header id="masthead" class="site-header" role="banner">            <hgroup>                <h1 class="site-title">                    <a href="/" title="歐陽克個(gè)人博客" rel="home">歐陽克個(gè)人博客</a>                </h1>                <h2 class="site-description">歐陽克是PHP中文網(wǎng)的講師,愿意把知識(shí)分享給大家。</h2>            </hgroup>            <nav id="site-navigation" class="main-navigation" role="navigation">                <ul class="nav-menu">                    <li>                        <a href="/">首頁</a>                    </li>                    {foreach $cat as $value}                    <li>                        <a href="?name={$value.name}">{$value.name}</a>                    </li>                    {/foreach}                </ul>            </nav>        </header>        <div id="main" class="wrapper">            <div id="primary" class="site-content">            {foreach($select as $select_v)}                <div id="content" role="main">                  <article>                    <header class="entry-header">                      <h1 class="entry-title">                        <a href="/details.html" title="構(gòu)建Nginx和PHP鏡像" rel="bookmark"                        >{$select_v['title']}</a>                      </h1>                    </header>                    <div class="entry-content">{$select_v['content']}</div>                    <footer class="entry-meta">                      發(fā)布于                      <a href="/index.html?time=2020-10-02" title="2020-10-02" rel="bookmark">                        <time class="entry-date" datetime="2020-10-02"                        >{$select_v['date']}</time                        > </a>。 屬于                      <a href="/index.html?cate=4" title="查看 Linux中的全部文章" rel="category"                      >{$select_v['cat']}</a>分類                    </footer>                  </article>                </div>            {/foreach}                <div class="page">                    <nav>                        <ul class="pagination">                            {$select|raw}                        </ul>                    </nav>                </div>            </div>            <div id="secondary" class="widget-area" role="complementary">                <aside id="search-2" class="widget widget_search">                    <form role="search" id="searchform" action="" method="POST">                        <div>                            <label class="screen-reader-text" for="t">搜索:</label>                            <input placeholder="搜索" type="text" class="no-border" name="keywords" id="t"/>                            <input type="submit" class="btn btn-default" id="searchsubmit" value="搜索" />                        </div>                    </form>                    <script type="text/javascript">                        $(function (){                          $("#searchsubmit").click(function (){                            if($("#t").val() != '') {                              location.href = "/index.html?t="+$("#t").val();                            }                            return false;                          });                        });                    </script>                </aside>                <aside id="recent-posts-2" class="widget widget_recent_entries">                    <h3 class="widget-title">熱門文章</h3>                    <ul>                        {foreach($select as $select_v)}                        {if $select_v.hot==1}                        <li>                            <font style="color:#7a7a7a;">[{$select_v.id}]</font>&nbsp;                            <a href="/details.html?id=20" title="{$select_v.title}">{$select_v.title}</a>                        </li>                        {/if}                        {/foreach}                    </ul>                </aside>            </div>        </div>        <footer id="colophon" role="contentinfo">            <div class="site-info">                <span>友情鏈接:</span>                    <a href="http://ipnx.cn" target="_blank">PHP中文網(wǎng)</a>                </div>        </footer>        <footer role="contentinfo" style="margin-top:0;">            <div class="site-info" style="text-align:center;">                <span>                    <a href="https://beian.miit.gov.cn" target="_blank">蘇ICP備2020058653號(hào)-1</a>                </span>            </div>        </footer>    </div></body></html>

效果

批改狀態(tài):未批改

老師批語:
本博文版權(quán)歸博主所有,轉(zhuǎn)載請(qǐng)注明地址!如有侵權(quán)、違法,請(qǐng)聯(lián)系admin@php.cn舉報(bào)處理!
全部評(píng)論 文明上網(wǎng)理性發(fā)言,請(qǐng)遵守新聞評(píng)論服務(wù)協(xié)議
0條評(píng)論
作者最新博文
關(guān)于我們 免責(zé)申明 意見反饋 講師合作 廣告合作 最新更新
php中文網(wǎng):公益在線php培訓(xùn),幫助PHP學(xué)習(xí)者快速成長!
關(guān)注服務(wù)號(hào) 技術(shù)交流群
PHP中文網(wǎng)訂閱號(hào)
每天精選資源文章推送
PHP中文網(wǎng)APP
隨時(shí)隨地碎片化學(xué)習(xí)
PHP中文網(wǎng)抖音號(hào)
發(fā)現(xiàn)有趣的

Copyright 2014-2025 http://ipnx.cn/ All Rights Reserved | php.cn | 湘ICP備2023035733號(hào)

  • 登錄PHP中文網(wǎng),和優(yōu)秀的人一起學(xué)習(xí)!
    全站2000+教程免費(fèi)學(xué)