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

                ??碼云GVP開源項目 12k star Uniapp+ElementUI 功能強大 支持多語言、二開方便! 廣告
                [TOC] ## 1 輔助函數文件函數列表(thinkphp\helper.php) ~~~ function A($name, $layer = CONTROLLER_LAYER) { return \think\Loader::controller($name, $layer); } ~~~ ~~~ function C($name = '', $value = null, $range = '') { if (is_null($value) && is_string($name)) { return \think\Config::get($name, $range); } else { return \think\Config::set($name, $value, $range); } } ~~~ ~~~ function cookie($name, $value = '') { if (is_array($name)) { // 初始化 \think\Cookie::init($name); } elseif (is_null($name)) { // 清除 \think\Cookie::clear($value); } elseif ('' === $value) { // 獲取 return \think\Cookie::get($name); } elseif (is_null($value)) { // 刪除session return \think\Cookie::delete($name); } else { // 設置session return \think\Cookie::set($name, $value); } } ~~~ ~~~ function D($name = '', $layer = MODEL_LAYER) { return \think\Loader::model($name, $layer); } ~~~ ~~~ function dump($var, $echo = true, $label = null) { return \think\Debug::dump($var, $echo, $label); } ~~~ ~~~ function db($config = []) { return \think\Db::connect($config); } ~~~ ~~~ function E($msg, $code = 0) { throw new \think\Exception($msg, $code); } ~~~ ~~~ function G($start, $end = '', $dec = 6) { if ('' == $end) { \think\Debug::remark($start); } else { return 'm' == $dec ? \think\Debug::getRangeMem($start, $end) : \think\Debug::getRangeTime($start, $end, $dec); } } ~~~ ~~~ function I($key, $default = null, $filter = '', $merge = false) { if (0 === strpos($key, '?')) { $key = substr($key, 1); $has = '?'; } else { $has = ''; } if ($pos = strpos($key, '.')) { $method = substr($key, 0, $pos); if (in_array($method, ['get', 'post', 'put', 'delete', 'param', 'request', 'session', 'cookie', 'server', 'globals', 'env', 'path', 'file'])) { $key = substr($key, $pos + 1); } else { $method = 'param'; } } else { $method = 'param'; } return \think\Input::$method($has . $key, $default, $filter, $merge); } ~~~ ~~~ function import($class, $baseUrl = '', $ext = EXT) { return \think\Loader::import($class, $baseUrl, $ext); } ~~~ ~~~ function L($name, $vars = [], $lang = '') { return \think\Lang::get($name, $vars, $lang); } ~~~ ~~~ function M($name = '', $tablePrefix = null, $connection = '') { return \think\Loader::table($name, ['prefix' => $tablePrefix, 'connection' => $connection]); } ~~~ ~~~ function R($url, $vars = [], $layer = CONTROLLER_LAYER) { return \think\Loader::action($url, $vars, $layer); } ~~~ ~~~ function S($name, $value = '', $options = null) { if (is_array($options)) { \think\Cache::connect($options); } elseif (is_array($name)) { return \think\Cache::connect($name); } if ('' === $value) { return \think\Cache::get($name); } elseif (is_null($value)) { return \think\Cache::rm($name); } else { if (is_array($options)) { $expire = isset($options['expire']) ? $options['expire'] : null; } else { $expire = is_numeric($options) ? $options : null; } return \think\Cache::set($name, $value, $expire); } } ~~~ ~~~ function session($name, $value = '') { if (is_array($name)) { \think\Session::init($name); } elseif (is_null($name)) { \think\Session::clear($value); } elseif ('' === $value) { return \think\Session::get($name); } elseif (is_null($value)) { return \think\Session::delete($name); } else { return \think\Session::set($name, $value); } } ~~~ ~~~ function T($class, $ext = EXT) { return \think\Loader::import($class, TRAIT_PATH, $ext); } ~~~ ~~~ function trace($log = '[think]', $level = 'log') { if ('[think]' === $log) { return \think\Log::getLog(); } else { \think\Log::record($log, $level); } } ~~~ ~~~ function U($url, $vars = '', $suffix = true, $domain = false) { return \think\Url::build($url, $vars, $suffix, $domain); } ~~~ ~~~ function V($template = '', $vars = []) { return \think\View::instance(\think\Config::get())->fetch($template, $vars); } ~~~ ~~~ function vendor($class, $ext = EXT) { return \think\Loader::import($class, VENDOR_PATH, $ext); } ~~~ ~~~ function W($name, $data = []) { return \think\Loader::action($name, $data, 'Widget'); } ~~~ ## 2 分析 1 `A() ` 調用Loader::controller,創建控制器實例。 >$name:控制器名稱 $layer:控制層 Loader分析見另:自動加載器實例化 * * * * * 2 `C()` 調用Config::get() Config::set()操作配置參數 >$name:配置參數名稱 $value:配置參數值,為空則get獲取,否則set設置 $range:參數作用域 Config分析見附:全局配置文件 * * * * * `cookie()` 調用think\Cookie操作cookie數據 >$name: >>數組:初始化cookie 為空:清除cookie >$value: >> null : 刪除session ' ' : 獲取cookie的$name 其他 : 設置cookie的$name的值 Cookie分析見另:Cookie.php文件 * * * * * 3 `D()` 調用Loader::model()創建數據模型對象 >$name:數據模型名稱 $layer:數據模型業務層 Loader分析見另:自動加載器實例化 * * * * * `dump()` 調用Debug::dump()格式化友好輸出數據 >$var: 輸出數據 $echo: treu,直接輸出;false,返回結果 $label:標簽控制 Debug分析見另:Debug.php文件 * * * * * `db()` 調用Db::connect()創建數據庫連接對象 >$config:數據庫連接配置 Db分析見 另:Db.php文件 * * * * * 4 `E()` 調用Exception()拋出異常 >$msg:異常消息 $code:異常代碼,默認為0 Exception分析見Exception.php文件 5 `G()` 調用Debug::remark()記錄資源使用情況 >$start:開始標簽 $end:結束標簽 $desc:小數位 Debug文件分析見另:Debug.php文件 6 `I()` 調用think\Input獲取輸入數據, >$key:鍵名[get.xx,表明參數來源,] $default:默認值 $filter:過濾出來 $merge: Input文件分析見另:Input.php文件 * * * * * `import()` 調用Loader快速導入類庫 * * * * * 7 `L()` 調用Lang::get()獲取語言變量配置 > $name:語言變量名稱 > $vars: > $lang: Lang分析見 另:Lang.php文件 * * * * * 8 `M()` 調用Loader::table()創建模型對象 > $name: 模型名稱 > $tablePrefix: 數據表前綴 > $connection 數據庫連接信息 * * * * * 9 `R()` 到普Loader::action()遠程調用控制器的操作 > $url:模塊/控制器/方法url > $vars:調用參數 > $layer: * * * * * 10 `S()` 調用Cache實現緩存 > $name:緩存名稱 > $value:緩存數據 > $options:緩存參數 Cache分析見另:Cache.php文件 * * * * * 11 `T()` 調用Loader快速導入Traits > $class:trait庫 > $ext:文件后綴 Traits的原理見基礎原理的php的trait * * * * * `trace()` 調用Log操作日志細心 > $log:log字符串 > $level:日志級別 Log分析見另:log.php文件 * * * * * 12 `U()` 調用Url生成url > $url,基礎url > $vars,參數 > $suffix, > $domain, Url分析見另:Url.php文件 * * * * * 13 `V()` 快速創建視圖對象, > $template:文件名稱 > $vars:模板變量 View分析見V:視圖渲染文件 * * * * * `venodr()` 調用Loader快速導入插件 * * * * * 14 `W()` 調用Loader::Action(),渲染輸出Widget組件 > $name:Widget名稱 > $data:參數 ## 3 總結 26個字母中除 B,F,H,J,K,N,O,P,Q,X,Y,Z外實現了14個單字母函數。 2個導入函數import,vendor 2個通信函數session,cookie 2個調試函數dump,trace 1個數據庫函數db 總共21個輔助函數。
                  <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>

                              哎呀哎呀视频在线观看