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

                ??一站式輕松地調用各大LLM模型接口,支持GPT4、智譜、豆包、星火、月之暗面及文生圖、文生視頻 廣告
                # 升級說明 > > + [5.0.X升級到5.1官方說明](http://www.hmoore.net/manual/thinkphp5_1/354155) >+ [5.0.X升級到5.1官方說明2](http://www.thinkphp.cn/topic/47882.html) 補充說明 * 獲取數據表信息 \think\Db::getTableinfo('表全名'); ## 添加修改post ``` //自動加入字段編輯 protected function changeData() { if ($this->request->isPost()){ $post = input('post.'); $post['test_time'] = strtotime(input('post.test_time')); $post['finish_time'] = strtotime(input('post.finish_time')); $post['charge_operator_time'] = strtotime(input('post.charge_operator_time')); $post['charge_customer_time'] = strtotime(input('post.charge_customer_time')); $this->request->withPost($post); } } ``` ## 1.入口文件 index.php >[info]如下,與之前版本有所區別 ~~~ <?php namespace think; // [ 應用入口文件 ] // 定義應用目錄 // supper tp5.1 if (!defined('DS')) { define('DS', DIRECTORY_SEPARATOR); } define('APP_PATH', __DIR__ . './apps/'); // 加載框架引導文件 require __DIR__ . './thinkphp/base.php'; // 執行應用并響應 Container::get('app', [APP_PATH])->run()->send(); ~~~ ## 2.配置區別 >[info]所有配置 位于項目 >config目錄下,并區分 >[warning] 注意: 模塊配置文件,集中存放在 項目 根目錄下的 **config** 之中,如下目錄結構 ~~~~ www WEB部署目錄(或者子目錄) ├─application 應用目錄 │ ├─common 公共模塊目錄(可以更改) │ ├─module_name 模塊目錄 │ │ ├─common.php 模塊函數文件 │ │ ├─controller 控制器目錄 │ │ ├─model 模型目錄 │ │ ├─view 視圖目錄 │ │ ├─config 配置目錄 │ │ └─ ... 更多類庫目錄 │ │ │ ├─command.php 命令行定義文件 │ ├─common.php 公共函數文件 │ └─tags.php 應用行為擴展定義文件 │ ├─config 應用配置目錄 │ ├─module_name _模塊配置目錄_ │ │ ├─database.php 數據庫配置 │ │ ├─cache 緩存配置 │ │ └─ ... ~~~~ ## 3.控制器 controller 注意點 ### 3.1初始化方法區別 默認初始化方法名稱變更 5.0.x版本為 **_initialize()** 而5.1為 **initialize()** >[warning] 注意 少了 **_** 5.1版本 代碼如下 ~~~ namespace app\index\controller; use think\Controller; class Index extends Controller { public function initialize() { echo 'init<br/>'; } ----- } ~~~ ### 3.2模板輸出區別【默認進行html過濾】 >[info]模板輸出html代碼需要特別注意,默認系統對html進行了過濾 ~~~ ..... class Index extends Controller { public function index() { $html = '<h1>hi</h1>'; $this->assgin('html',$html); return $this->fetch(); } ..... } 要輸出完整的html 在對應模板 index.html 中 {$hmtl |raw} ~~~ >[warning] 調用函數 raw 進行處理, ## 4.原系統常量問題 >[info]5.1版本后,取消了系統常量 * 解決辦法一 > 參考之前版本,自定義 define('XXX','sdfsdf'); * 解決方法二 > 采用tp5.1 版本方法 > 如獲取系統版本信息, ` app()->version() ` 注:之前是 `THINK_VERSION` Env::get(); 或 app('env')->get() ## 5.系統類實例化區別 > 實例化緩存類方法 * 方法一 類以于以前版本 ~~~ use think\facade\Cache; $cache = new Cache(); ~~~ * 方法二 新方法 ~~~ //// 注冊容器對象實例 $app = app(); // 判斷對象實例是否存在 isset($app->cache); $app->cache = think\Cache::class; // 獲取容器中的對象實例 $cache = $app->cache; // 快速調用(自動實例化) $cache = app('cache'); // 每次調用都會重新實例化 $cache = app('cache',true); ~~~
                  <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>

                              哎呀哎呀视频在线观看