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

                企業??AI智能體構建引擎,智能編排和調試,一鍵部署,支持知識庫和私有化部署方案 廣告
                ## 模板賦值 除了系統變量和配置參數輸出無需賦值外,其他變量如果需要在模板中輸出必須首先進行模板賦值操作,綁定數據到模板輸出有下面幾種方式: |版本|新增功能| |---|---| |5.0.4|增加全局靜態模板賦值方法`share`| ### `assign`方法 ~~~ namespace index\app\controller; class Index extends \think\Controller { public function index() { // 模板變量賦值 $this->assign('name','ThinkPHP'); $this->assign('email','thinkphp@qq.com'); // 或者批量賦值 $this->assign([ 'name' => 'ThinkPHP', 'email' => 'thinkphp@qq.com' ]); // 模板輸出 return $this->fetch('index'); } } ~~~ ### 傳入參數方法 方法fetch 及 display 均可傳入模版變量,例如 ~~~ namespace app\index\controller; class Index extends \think\Controller { public function index() { return $this->fetch('index', [ 'name' => 'ThinkPHP', 'email' => 'thinkphp@qq.com' ]); } } ~~~ ~~~ class Index extends \think\Controller { public function index() { $content = '{$name}-{$email}'; return $this->display($content, [ 'name' => 'ThinkPHP', 'email' => 'thinkphp@qq.com' ]); } } ~~~ ### 助手函數 如果使用view助手函數渲染輸出的話,可以使用下面的方法進行模板變量賦值: ~~~ return view('index', [ 'name' => 'ThinkPHP', 'email' => 'thinkphp@qq.com' ]); ~~~ ### `share`方法 `V5.0.4+`開始,支持在任何地方使用靜態方法進行模板變量賦值,例如: ~~~ think\View::share('name','value'); // 或者批量賦值 think\View::share(['name1'=>'value','name2'=>'value2']); ~~~ 全局靜態模板變量最終會和前面使用方法賦值的模板變量合并。
                  <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>

                              哎呀哎呀视频在线观看