fry404006308/personalblog: personalblog
後台操作完成的差不多了,下面開始前台操作
在後台設定好的資料分配到前台
後台資料
資料庫資料
前台資料
下面講如何操作
控制器中得到資料並分配資料
1檢視頁面顯示資料<?php23
4use
think\controller;
5use
think\db;
6class index extends
controller
716 }
1可以寫乙個基類,然後其它類繼承這個基類來完成對資料的分配。2$value['id']))}" rel='dropmenu209'>
3
之前的頁面傳遞的資料
1控制器<
a href
=""rel
='dropmenu209'
>首頁
a>23
<
a href
=""rel
='dropmenu209'
>
a>
4
1檢視public
function
index()
2
1就是你看到的源**的部分是已經執行過邏輯的部分了,所以邏輯部分你是看不到的,比如說php邏輯部分。<
div
class
="left"
>23
4<
div
class
="xnews2"
>
5<
div
class
="pic"
>
6<
a target
="_blank"
href
="20160920156216.html"
>
7<
img
src="__img__ __public__/images/error.png " alt
=""/>8a
>
9div
>
10<
div
class
="dec"
>
11<
h3><
a target
="_blank"
href
="20160920156216.html"
>
a>
h3>
12<
div
class
="time"
div>
13<
p>
p>
14<
div
class
="time"
><
a href
='z97712.html'
>聚餐
每訪問一次這個方法就會讓這個文章的訪問量自動增加一次
1thinkphp手冊參考<?php23
4use
5class article extends
base
622 }
1改紫色框框的位置,而不是下面的zerofill自增或自減乙個欄位的值
2 setinc/setdec 如不加第二個引數,預設值為134
//score 欄位加 1
5 db::table('think_user')
6 ->where('id', 1)
7 ->setinc('score');8//
score 欄位加 5
9 db::table('think_user')
10 ->where('id', 1)
11 ->setinc('score', 5);
12//
score 欄位減 1
13 db::table('think_user')
14 ->where('id', 1)
15 ->setdec('score');
16//
score 欄位減 5
17 db::table('think_user')
18 ->where('id', 1)
19 ->setdec('score', 5);
控制器
1檢視<?php23
4use
5class article extends
base
622 }
1234class="position">主頁 > $cateres['id']))}"> > 56
class="overall">
7class="left">
8class="scrap">910
class="spread">
11##}
1213
class="writor">標籤:聚餐
14class="writor">熱度:
1516
1718
1920
21class="takeaway">
22class="btn arr-left">
23class="jjxq">
2425
class="btn arr-right">
2627
2829
30class="substance">
31
3233
<1<div
class
="position"
><
a href
="}"
>主頁
a> > <
a href
="">
a> >
div>
span
class
="writor"
span
>
thinkphp5專案 個人部落格(八)
控制器1 4use 5class search extends base 6else 24return view 25 26 按照文章標題搜尋 1 按照標題搜尋 2 map title like keywords.3 searchres db article where map order id d...
linux下部署thinkphp5專案
1.安裝phpstudy for linux 在xshell中輸入 wget c chmod x phpstudy.bin 許可權設定 phpstudy.bin 執行安裝 安裝過程中有php版本和伺服器的選擇,這些按它的提示選擇就行,一段時間 20分鐘左右 後就安裝好了。末了,它會告訴你一些phps...
thinkPHP5專案實戰 04 命名空間的引入
1.為命名空間名稱使用別名 即在命名空間中引入其他的命名空間,使用use操作符實現。引入其他的命名空間後,使用只需在元素前面加上子命名空間的字首即可,無需寫上引入的全部空間名稱 header content type text html charset utf 8 function func con...