<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之旅 廣告
                ## 頁面跳轉 在應用開發中,經常會遇到一些帶有提示信息的跳轉頁面,例如操作成功或者操作錯誤頁面,并且自動跳轉到另外一個目標頁面。插件內置了兩個跳轉方法`success`和`error`,用于頁面提示。 使用方法很簡單,舉例如下: ~~~ <?php // +---------------------------------------------------------------------- // | onegow [ WE CAN DO IT MORE SIMPLE] // +---------------------------------------------------------------------- // | Copyright (c) 2016-2018 http://onegow.com All rights reserved. // +---------------------------------------------------------------------- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 ) // +---------------------------------------------------------------------- // | Author: mrye 55585190@qq.com // +---------------------------------------------------------------------- namespace inc\mobile; class Index extends Base { public function index() { $data = []; if (Db::name('user')->insert($data)) { //設置成功后跳轉頁面的地址,默認按鈕沒有跳轉功能 $this->success('新增成功', 'User/list'); } else { //錯誤頁面的默認跳轉頁面是返回前一頁,通常不需要設置 $this->error('新增失敗','User/error'); } } } ~~~ 在`ajax`的情況下會調用插件內部中的`echo_json`方法,并且截斷。 ## 獲取表單參數 在獲取用戶提交的表單時可以使用`input`函數,用法和tp類似: ~~~ /** * 為了避免惡意攻擊或者惡意提交參數 * 使用 input 或者$this->input 時可指定參數過濾,默認過濾xss,在提交html或腳本時需注意切換,否則將獲取不到參數 * 可選列表:xss、sql、int、integer、float、string、boolean * */ $value = $this->input('where','','sql'); ~~~ 在獲取頭部表單時可以使用`header`函數,用法和tp類似: ~~~ $header = $this->header('name'); ~~~ 判斷客戶端請求方式時可以使用`isAjax`函數,用法和tp類似: ~~~ if($this->isAjax()) { echo '是ajax請求'; } if($this->isPost()) { echo '是post請求'; } if($this->isGet()) { echo '是get請求'; } ~~~ ## session和cookie 插件內部提供了函數session用來設置和獲取session,例如: ~~~ // 賦值(當前作用域) $this->session('name', 'mrye'); // 賦值并設置過期時間(當前作用域) $this->session('name', 'mrye', 86400); // 刪除(當前作用域) $this->session('name', null); ~~~ 插件內部提供了函數cookie用來設置和獲取cookie,例如: ~~~ // 賦值(當前作用域) $this->cookie('name', 'mrye'); // 賦值并設置過期時間(當前作用域) $this->cookie('name', 'mrye', 86400); // 刪除(當前作用域) $this->cookie('name', null); ~~~ ## 其它方法說明 獲取客戶端真實ip是可使用: ~~~ $clientIp = $this->ip(); ~~~ 判斷客戶端是否是移動端是可使用: ~~~ if($this->isMobile()) { echo '是移動端'; } ~~~ 客戶端使用接口形式訪問時,調用`echoJson`輸出json數據 ~~~ $this->echoJson('操作成功',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>

                              哎呀哎呀视频在线观看