<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>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                ``` ~~~ 本節課大綱: 一、多應用配置技巧 二、使用分組 三、頁面跳轉 $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); } } ~~~ ```
                  <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>

                              哎呀哎呀视频在线观看