兄弟連ThinkPHP3.1基礎視頻教程的資源推薦

來源:互聯網
上載者:User
ThinkPHP是為了簡化企業級應用開發和敏捷WEB應用開發而誕生的。最早誕生於2006年初,2007年元旦正式更名為ThinkPHP,並且遵循Apache2開源協議發布。ThinkPHP從誕生以來一直秉承簡潔實用的設計原則,在保持出色的效能和至簡的代碼的同時,也注重易用性。並且擁有眾多原創功能和特性,在社區團隊的積极參与下,在易用性、擴充性和效能方面不斷最佳化和改進。

課程播放地址:http://www.php.cn/course/383.html

該老師講課風格:

教師講課深入淺出,條理清楚,層層剖析,環環相扣,論證嚴密,結構嚴謹,用思維的邏輯力量吸引學生的注意力,用理智控制課堂教學進程。教學的技巧,充滿著機智,各種教學方法、技巧信手拈來,運用自如,恰到好處,並絲毫不帶有雕琢的痕迹。

本視頻中較為痛點的應該是:分組、頁面跳轉與ajax:

一、多應用配置技巧
二、使用分組
三、頁面跳轉
$this->success('查詢成功',U('User/test'));
$this->redirect('User/test','',5,'頁面正在跳');
四、Ajax技巧

前後台公用公用設定檔:    $ pwd  /cygdrive/c/wamp/www/thinkphp5/Admin/Conf    Administrator@QCEE61NZ66FEX2D /cygdrive/c/wamp/www/thinkphp5/Admin/Conf  $ ls  config.php    Administrator@QCEE61NZ66FEX2D /cygdrive/c/wamp/www/thinkphp5/Admin/Conf  $ cat config.php  <?php  $arr=include './config.php';    $arr2=array(    );  return  array_merge($arr,$arr2);      ?>    // 目前的目錄下的config.php,這個當前是指主入口的路徑:      $arr=include './config.php';        公用設定檔:  $ pwd  /cygdrive/c/wamp/www/thinkphp5    Administrator@QCEE61NZ66FEX2D /cygdrive/c/wamp/www/thinkphp5  $ ls -ltr config.php  -rwxrwx---+ 1 Administrators None 393 五月  9 13:14 config.php    Administrator@QCEE61NZ66FEX2D /cygdrive/c/wamp/www/thinkphp5  $ cat config.php  <?php  return array(          //'配置項'=>'配置值'          'TMPL_L_DELIM'=>'<{',   //配置左定界符          'TMPL_R_DELIM'=>'}>',    //配置右定界符          'DB_PREFIX'=>'',     //設定表首碼          'DB_DSN'=>'mysql://root:1234567@192.168.32.79:3306/devops', //DSN方式設定資料庫資訊          'SHOW_PAGE_TRACE'=>true,//開啟頁面Trace          /* 'URL_ROUTER_ON'=>true,          'URL_ROUTE_RULES'=>array(           ':id/:num'=>'Index/index',           ), */  );  ?>  Administrator@QCEE61NZ66FEX2D /cygdrive/c/wamp/www/thinkphp5            thinkphp 分組機制:    <?php  //1.確定應用程式名稱 Home    define('APP_NAME','App');    //2. 確定應用路徑  ./Home 目前的目錄 index.php的目前的目錄 前台檔案夾    define('APP_PATH','./App/');  //開啟偵錯模式     define('APP_DEBUG',true);  //4.引入核心檔案 include 引入的東西錯誤 代碼繼續運行  require 出錯立即結束    require './ThinkPHP/ThinkPHP.php';    ?>          'APP_GROUP_LIST' => 'Home,Admin', //項目分組設定  'DEFAULT_GROUP'  => 'Home', //預設分組            在同一個應用下,再分不同的應用:    $ pwd  /cygdrive/c/wamp/www/thinkphp6/App/Lib/Action    Administrator@QCEE61NZ66FEX2D /cygdrive/c/wamp/www/thinkphp6/App/Lib/Action  $ ls  Admin  Home  IndexAction.class.php      整個應用叫app應用:    <?php  //1.確定應用程式名稱 Home    define('APP_NAME','App');    //2. 確定應用路徑  ./Home 目前的目錄 index.php的目前的目錄 前台檔案夾    define('APP_PATH','./App/');  //開啟偵錯模式     define('APP_DEBUG',true);  //4.引入核心檔案 include 引入的東西錯誤 代碼繼續運行  require 出錯立即結束    require './ThinkPHP/ThinkPHP.php';    ?>              推薦使用分應用的方式,而不是分組      分應用情況下的訪問方式,多應用配置技巧:      $ pwd  /cygdrive/c/wamp/www/thinkphp5    Administrator@QCEE61NZ66FEX2D /cygdrive/c/wamp/www/thinkphp5  $ ls  Admin  admin.php  config.php  Home  index.php  ThinkPHP      Home前台應用檔案夾:    Admin後台應用檔案夾:    http://localhost/thinkphp5/admin.php    http://localhost/thinkphp5/index.php        //頁面跳轉:    <?php  // 本類由系統自動產生,僅供測試用途  class IndexAction extends Action {      public function index(){      echo "come in Home!";      $user=M('user');      $arr=$user->select();      dump($arr);      //分配給前台,表示為list       $this->assign('list','$arr');      $this->display();      }  }        前端頁面:  <!doctype html>  <html lang="en">   <head>    <meta charset="UTF-8">    <meta name="Generator" content="EditPlus">    <meta name="Author" content="">    <meta name="Keywords" content="">    <meta name="Description" content="">    <title>Document</title>   </head>   <body>        <table border='1' width='500'>    <foreach name='list' item='vo'>      <tr><td><{$vo.username}></td></tr>      </foreach>      </table>   </body>  </html>      //超連結:    <!doctype html>  <html lang="en">   <head>    <meta charset="UTF-8">    <meta name="Generator" content="EditPlus">    <meta name="Author" content="">    <meta name="Keywords" content="">    <meta name="Description" content="">    <title>Document</title>   </head>   <body>        <table border='1' width='500'>    <foreach name='list' item='vo'>      <tr><td><a href="__URL__/info?id=<{$vo.id}>"><{$vo.username}></a></td></tr>      </foreach>      </table>   </body>  </html>          <?php  // 本類由系統自動產生,僅供測試用途  class IndexAction extends Action {      public function index(){      echo "come in Home!";      $user=M('user');      $arr=$user->select();      dump($arr);      //分配給前台,表示為list       $this->assign('list',$arr);      $this->display();      }            public function info(){          $id=$_GET['id'];          $user=M('user');          $arr=$user->find($id);          dump($arr);          if ($arr){              $this->success('index');          }          else {              //失敗後自動跳轉到上一頁              $this->error('查詢失敗');          }          $this->assign('list',$arr);          $this->display();      }  }      //redirect 跳轉:    <?php  // 本類由系統自動產生,僅供測試用途  class IndexAction extends Action {      public function index(){      echo "come in Home!";      $user=M('user');      $arr=$user->select();      dump($arr);      //分配給前台,表示為list       $this->assign('list',$arr);      $this->display();      }            public function info(){          $id=$_GET['id'];          $user=M('user');          $arr=$user->find(100);          dump($arr);          if ($arr){              $this->success('index');          }          else {              //失敗後自動跳轉到上一頁              $this->redirect('User/index');          }          $this->assign('list',$arr);          $this->display();      }  }      跳轉到:  http://localhost/thinkphp5/index.php/User/index    User/index 頁面        Ajax 技巧:        在架構裡面,指令碼都是被方法所取代      <!doctype html>  <html lang="en">   <head>    <meta charset="UTF-8">    <meta name="Generator" content="EditPlus">    <meta name="Author" content="">    <meta name="Keywords" content="">    <meta name="Description" content="">    <title>Document</title>    <script src="__PUBLIC__/Js/jquery.js"></script>    <script>    $(function(){    $('button').bind('click',function(){         $.get('__URL__/getAjax',function(jdata){      <!--alert (JSON.stringify(data));-->      if (jdata.status==1){      alert(jdata.data);      }    });    });          });          </script>   </head>   <body>     <div style='height:50px;background:yellow' id='did'></div>     <button>點擊</button>     <script>       document.write(new Date());       </script>   </body>  </html>      <?php  class IndexAction extends Action {            public function index(){          $this->display();      }            public function getAjax(){          //echo 'aaaaaaa';          $this->ajaxReturn('這裡是資料','資訊1',1);      }    }

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.