<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ## phpstudy 安裝: #### 1. 請點擊此處下載http://www.phpstudy.net/download.html #### 2. 根目錄:D:\phpStudy\WWW #### 3. 把TP5框架文件,放到根目錄下面,并將文件夾名字重命名為test。 ![](https://box.kancloud.cn/00dd82492e715ba7f2ccae364d1f64aa_499x265.jpg) #### 4. 打開瀏覽器,在地址欄中輸入http://localhost/test/public/ ![](https://box.kancloud.cn/fbc400698609cc2bbc4347e73c05b605_760x582.jpg) #### 5. 了解TP5框架的MVC 三層架構。打開 D:\phpStudy\WWW\test\application\index\controller 下面的index.php; ![](https://box.kancloud.cn/e4ddda965a294233f6c4c0194f5ce81a_1327x556.jpg) 將index.php中代碼改為: ~~~ <?php namespace app\index\controller; class Index { public function index() { return 'hello world'; } } ?> ~~~ 刷新瀏覽器:出現“hello world”。 ![](https://box.kancloud.cn/73766c5cae7bbe95e4ce36b57d013099_597x333.jpg) #### 6. 新建數據庫:數據庫名稱:test ,新建表:user。 ![](https://box.kancloud.cn/c8cf656fc3997f0ce9d815a71af7911b_599x342.jpg) #### 7. 連接數據庫:打開D:\phpStudy\WWW\test\application\database.php ![](https://box.kancloud.cn/c10e39d9e95373f7c54d11ed8e42f923_1244x795.jpg) 修改圖中 數據庫名、 密碼 等選項。(根據個人數據庫設定修改) **新建model層:** D:\phpStudy\WWW\test\application\index\model\User.php;代碼如下: ~~~ <?php namespace app\index\model; use think\Model; class User extends Model { } ?> ~~~ **修改D:\phpStudy\WWW\test\application文件夾下的config.php文件:** false改為true。 ![](https://box.kancloud.cn/6db3eee16df98cc0d014291939419049_996x781.jpg) ~~~ // 控制器類后綴 'controller_suffix' => true, ~~~ **對應的index控制器都加后綴Controller;** 1、文件名由Index.php=>IndexController.php 2、IndexController.php代碼修改: ~~~ <?php namespace app\index\controller; use think\Controller; use app\index\model\User;//引用User模板; class IndexController extends Controller { public function index() { return 'hello world'; } } ?> ~~~ **讀取數據庫數據:** IndexController.php: ~~~ <?php namespace app\index\controller; use think\Controller; use app\index\model\User; use think\Db; class IndexController extends Controller { public function index() { $sql = new User; $sqldata = Db::table('User')-> where('Id','>','0')->select(); dump($sqldata) ; //return $this->fetch(); } } ?> ~~~ 刷新瀏覽器: ![](https://box.kancloud.cn/a38d8a906da970903f71d89e34f6af9f_493x444.jpg) ok,搞定數據庫! 下面就開始弄前端的index.html了 ^_^ 。。。
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看