<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之旅 廣告
                **1 thinkphp5開發流程** ![](https://box.kancloud.cn/2016-03-14_56e622935ecd6.png) 目錄配置如圖【IDE phpstorm】 1. 把public文件夾下面的index.php和.htaccess都放到根目錄下 2. ![](https://box.kancloud.cn/2016-03-14_56e622938feb4.png) 3. 修改如上圖所示。最好自己自定義一個ROOt_PATH.方便未來上傳文件或者進行xls以及word讀寫編輯的時候發生路徑不統一的問題 4. 把build.php放到runtime下面。方便git進行配置。因為runtime設置為gitignore![](https://box.kancloud.cn/2016-03-14_56e62293bcf33.png) 5. 隨后自己新建一個模塊。命名隨意。只需要有Controller文件夾。同時又一個php控制器! * * * * * ~~~ namespace app\xzxs\controller; class Build { public function index(){ $build = new \think\Build(); $info = require APP_PATH."/runtime/build.php"; $build->run($info); } } ~~~ * * * * * 6. 訪問http://localhost/yourfolder/YourModel/YourController/index/ 就可以看到生成了所有的目錄。分別為Api對應輸出目錄。后臺backstage,前臺index。另外需要再有一個基礎控制模塊。 7. 至此整個運行流程創建完成。可以根據以前版本一樣進行流程開發 * * * * * **2 Cron定時器** 前提:需要自己在behavior下面先新建CronRunBehavior.php 代碼如下: ~~~ namespace Behavior; /** * 自動執行任務 */ class CronRunBehavior { public function run(&$params) { // 鎖定自動執行 $lockfile = RUNTIME_PATH.'cron.lock'; if(is_writable($lockfile) && filemtime($lockfile) > $_SERVER['REQUEST_TIME'] - C('CRON_MAX_TIME',null,60)) { return ; } else { touch($lockfile); } set_time_limit(1000); ignore_user_abort(true); // 載入cron配置文件 // 格式 return array( // 'cronname'=>array('filename',intervals,nextruntime),... // ); if(is_file(RUNTIME_PATH.'~crons.php')) { $crons = include RUNTIME_PATH.'~crons.php'; }elseif(is_file(APP_PATH.'crons.php')){ $crons = include APP_PATH.'crons.php'; } if(isset($crons) && is_array($crons)) { $update = false; $log = array(); foreach ($crons as $key=>$cron){ if(empty($cron[2]) || $_SERVER['REQUEST_TIME']>=$cron[2]) { // 到達時間 執行cron文件 G('cronStart'); include ROOT_PATH.'public/cron/'.$cron[0].'.php'; G('cronEnd'); $_useTime = G('cronStart','cronEnd', 6); // 更新cron記錄 $cron[2] = $_SERVER['REQUEST_TIME']+$cron[1]; $crons[$key] = $cron; $log[] = "Cron:$key Runat ".date('Y-m-d H:i:s')." Use $_useTime s\n"; $update = true; } } if($update) { // 記錄Cron執行日志 \Think\Log::write(implode('',$log)); // 更新cron文件 $content = "<?php\nreturn ".var_export($crons,true).";\n?>"; file_put_contents(RUNTIME_PATH.'~crons.php',$content); } } // 解除鎖定 unlink($lockfile); return ; } } ~~~ 或者從3.2.3拷貝。但是需要做一定修改 需要application目錄如下 ![](https://box.kancloud.cn/2016-03-14_56e62293dfe29.png) 首先在Tags.php里面進行如下配置 ~~~ return array( 'app_begin' => array('behavior\CronRunBehavior'), ); ~~~ 然后在crons.php里面進行如下配置 ~~~ return array( '測試定時任務' => array('index', '10', ''), //路徑(格式同R)、間隔秒(0為一直運行)、指定一個開始時間 ); ~~~ ![](https://box.kancloud.cn/2016-03-14_56e62293f2514.png) 對應的運行文件在如下目錄 **3 Taglib類庫自動加載**
                  <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>

                              哎呀哎呀视频在线观看