第七色在线视频,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 邏輯清晰
  • 靜態(tài)方法findBySql where(['>,''id','0']) id>1 對(duì)象占用的內(nèi)存高 ->asAraay() 轉(zhuǎn)化為數(shù)組降低內(nèi)存,
    查看全部
  • $cookies->getVlaue('user')
    查看全部
  • 數(shù)據(jù)模型: 1,和表名一致的文件; 2,引入命名空間:namespace app\models; 3, 使用命名空間:use yii\db\ActiveRecord; 4, 創(chuàng)建與表名一致的類(lèi)并繼承ActiveRecord; class tablename extends ActiveRecord{}
    查看全部
  • $layout = common ; //布局文件 $this 視圖組件 如果想替換公共文件中的某段(數(shù)據(jù)塊),可以在視圖文件中使用: <?php $this->beginBlock('block1'); ?> <h1>....</h1> <?php $this->endBlock();?> 公共文件中調(diào)用 <?=$this->blocks['block1'];?> 判斷顯示數(shù)據(jù)塊有木有,然后在顯示 <?php if(isset($this->blocks['block1'])):?> <?=$this->blocks['block1'];?> <?php else: ?> <h1>hello Common </h1> <?php endif; ?>
    查看全部
  • 在一個(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'))
    查看全部
  • 防止sql和script注入 <?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>代碼
    查看全部
  • 布局文件 /views/laysout/
    查看全部
    0 采集 收起 來(lái)源:視圖之布局文件

    2015-08-09

  • session.save_path session 保存的路徑,在php.ini中設(shè)置 $session->set(); $session->get()取出session數(shù)據(jù) $session->remove()刪除session數(shù)據(jù) /可以通過(guò)數(shù)組方式進(jìn)行操作session $session[] = '' unset($sission[])//刪除 //兩張方式,一種是對(duì)象方式處理,另一種是數(shù)組方式
    查看全部
  • 相應(yīng)處理: $res = \YII::response; 更改狀態(tài)碼:$res->statusCode = "404"; 添加header: $res->header->add("pragma", "no-cache"); 修改header: $res->header->set("pragma", "max-age=5"); 刪除header: $res->header->remove("pragma"); 跳轉(zhuǎn): $res->header->add("location", "http://www.baidu.com"); 重定向:$this->redirect("http://www.baidu.com", "302"); 文件下載:$res->header->add("content-disposition", "attachment; filename="a.jpg"); $res->sendFile("./robots.txt");
    查看全部
  • //修改數(shù)據(jù) $result = Test::find()->where(['id'=>4])->one(); $result->title="title4"; $result->save();
    查看全部
  • <?php namespace app\models; use yii\db\ActiveRecord; use yii\validators; /** * */ class Test extends ActiveRecord { public function rules(){ return [ ['id','integer'], ['title','string','length'=>[0,5]] ]; } } //HelloController //添加數(shù)據(jù) $test = new Test; $test->id="dss"; $test->title="title3"; $test->validate(); if($test->hasErrors()){ echo "data is error "; die; } $test->save();
    查看全部
  • //刪除數(shù)據(jù) //$results = Test::find()->where(['id'=>1])->all(); //$results[0]->delete(); Test::deleteAll('id>:id',array(':id'=>0));
    查看全部
  • //查詢(xún)數(shù)據(jù) // $sql="SELECT * FROM test"; // $results = Test::findBySql($sql)->all(); //id=1 // $results = Test::find()->where(["id"=>1])->all(); // print_r($results); //id>0 /*$results = Test::find()->where(['>','id',0])->all(); print_r($results);*/ //id>=1 and id<=2 //$results = Test::find()->where(['between','id',1,2])->all(); //echo count($results); //title like '%title%' //$results=Test::find()->where(['like','title','title'])->all(); //print_r($results); //將查詢(xún)結(jié)果轉(zhuǎn)換成數(shù)組 // $results=Test::find()->where(['like','title','title'])->asArray()->all(); //批量查詢(xún) foreach ($Test::find()->batch(2) as $value) { # code... } print_r($results);
    查看全部
  • dsf
    查看全部
  • $sql="select * from test where id=:id";//占位符 $result = Test::findysql($sql,array('id'=>'1'))->all();
    查看全部

舉報(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)系客服咨詢(xú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)的支持!