第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

Yii框架不得不說(shuō)的故事—基礎(chǔ)篇(1)

withy PHP開(kāi)發(fā)工程師
難度中級(jí)
時(shí)長(zhǎng) 2小時(shí)39分
學(xué)習(xí)人數(shù)
綜合評(píng)分9.67
176人評(píng)價(jià) 查看評(píng)價(jià)
9.9 內(nèi)容實(shí)用
9.7 簡(jiǎn)潔易懂
9.4 邏輯清晰
  • 關(guān)聯(lián)查詢
    查看全部
  • common.php
    查看全部
  • 視圖數(shù)據(jù)過(guò)濾
    查看全部
  • <?php use yii\helpers\Html; ?> <h1><?=Html::encode($view_hello_str);?></h1>
    查看全部
  • 視圖傳遞數(shù)據(jù)
    查看全部
  • $cookie = \YII::$app->response->cookie; $cookie_data=array('name'=>'user','value'=>'zhangsi'); $cookes->add(new Cookie($cookie_data)); $cookies->remove('id'); $cookies = \YII::$app-.request->cookies; echo $cookies->getValue('users',20);
    查看全部
  • 關(guān)聯(lián)查詢結(jié)果緩存 unset($customer->orders) //關(guān)聯(lián)查詢的多次查詢 $customers = Customer::find()->with('orders')->all() foreach($customers as $customer){ $orders = $customer->orders }
    查看全部
  • 關(guān)聯(lián)查詢: hasMany:一對(duì)多,hasOne:一對(duì)一 $customer->orders; $customer當(dāng)沒(méi)有orders屬性時(shí),$customer自動(dòng)調(diào)用_get()方法,拼接調(diào)用getOrders()方法,并自動(dòng)在后面加上all()方法或者one()方法,至于何時(shí)自動(dòng)拼接all或者one,取決于關(guān)聯(lián)查詢是用的hasMany還是hasOne,如果是hasMany則拼接all,否則反之。 //關(guān)聯(lián)查詢 //根據(jù)顧客查詢她/他的訂單的信息 // $customer = Customer::find()->where(['name'=>'zhangsan'])->one(); // $order = $customer->hasMany('app\models\Order',['customer_id'=>'id'])->asArray()->all(); // $orders = $customer->getOrders(); // $orders = $customer->orders; // print_r($orders); //根據(jù)訂單查詢顧客的信息 $order = Order::find()->where(['id'=>1])->one(); $customer = $order->customer; //以屬性的方式獲取數(shù)據(jù) print_r($customer); 注:若使用以屬性的方式獲取數(shù)據(jù),則在模型里面要定義一個(gè)方法,該方法要以get+屬性的命名方式。
    查看全部
  • 添加數(shù)據(jù): helloController.php文件: $test = new Test; $test->id = 3; $test->title = 'title3'; $test->validate();//驗(yàn)證器,驗(yàn)證字段是否合法 if($test->hasErrors()){ echo 'data is error';//字段不合法 die; } $test->save(); 如果想要驗(yàn)證,在模型test.php文件中有對(duì)應(yīng)的方法rules進(jìn)行驗(yàn)證 test.php: public function rules(){ return [ ['id','integer'],['title','string','length'=>[0,5]]]; }
    查看全部
  • 表單刪除: delete();先從表中查找出來(lái),查出來(lái)的是一個(gè)對(duì)象,然后再調(diào)用對(duì)象里的delete方法進(jìn)行刪除 $res = Test::find()->where(['id'=>1])->all(); $res[0]->delete(); deleteAll(); 直接使用deleteAll進(jìn)行刪除 Test::deleteAll('id>:id',array(':id'=>0));刪除id大于0的數(shù)據(jù)
    查看全部
  • 數(shù)據(jù)模型: 1,和表名一致的文件; 2,引入命名空間:namespace app\models; 3, 使用命名空間:use yii\db\ActiveRecord; 4, 創(chuàng)建與表名一致的類并繼承ActiveRecord; class tablename extends ActiveRecord{}
    查看全部
  • 模板中數(shù)據(jù)塊使用方式 <?php $this->beginBlock('block1');?> <h1>index111</h1> <?php $this->endBlock();?> 在布局模板中就這樣顯示 //判斷顯示數(shù)據(jù)塊有木有,然后在顯示 <?php if(isset($this->blocks['block1'])):?> <?=$this->blocks['block1'];?> <?php else: ?> <h1>hello Common </h1> <?php endif; ?> <?=$this->blocks['block1'];?> <?=$content; ?>
    查看全部
  • 在一個(gè)視圖(index.php)中顯示另一個(gè)試圖(about.php): 在視圖index.php文件中使用$this->render('about')顯示about視圖; 當(dāng)需要傳入?yún)?shù)時(shí),用render的第二個(gè)參數(shù):$this->render('about',array('key'=>'value'))
    查看全部
  • render兩種作用,第一是放到$content中,第二是顯示layout布局
    查看全部
    0 采集 收起 來(lái)源:視圖之布局文件

    2015-08-02

  • <?php use yii\helpers\Html; use yii\helpers\HtmlPurifier; ?> <P><?=Html::encode($view_hello_str) ?> </P>//可以原樣顯示<script></script>代碼 <P><?=HtmlPurifier::process($view_hello_str) ?> </P>//可以過(guò)濾掉<script></script>代碼
    查看全部

舉報(bào)

0/150
提交
取消
課程須知
學(xué)習(xí)本門(mén)課程之前,建議先了解一下知識(shí),會(huì)更有助于理解和掌握本門(mén)課程 1、掌握PHP基本的語(yǔ)言語(yǔ)法 2、對(duì)MVC開(kāi)發(fā)方式有一定的了解
老師告訴你能學(xué)到什么?
1、php的新特征 2、一款前沿的框架的使用方式 3、新穎獨(dú)到的程序設(shè)計(jì)

微信掃碼,參與3人拼團(tuán)

微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)

友情提示:

您好,此課程屬于遷移課程,您已購(gòu)買(mǎi)該課程,無(wú)需重復(fù)購(gòu)買(mǎi),感謝您對(duì)慕課網(wǎng)的支持!