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

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                **一些內置函數** 命令行中,防止重復執行 ~~~ if(!is_cli()){ exit('RUN IN CLI'); } set_time_limit(-1); ini_set('memory_limit','1024M'); cli_prevent_duplication($argv, $cmd = 'php io.php'); ~~~ 判斷平臺管理員是否登錄,未登錄自動跳到登錄頁 ~~~ check_admin_login(); ~~~ 寫日志 ~~~ write_log($msg,$is_error = false) ~~~ 生成條形碼 ~~~ $bar = new lib\Barcode; echo $bar->display(date("YmdHis"));exit; ~~~ 發送郵件,配置在 `config.ini.php`中。 ~~~ \lib\Mail::send([ 'from' => 'ddd@163.com', 'to' => $data['email'], 'subject'=> "標題, 'html' => "<p>內容</p>" ]); ~~~ 取位置lat,lng ~~~ https://lbs.qq.com/dev/console/key/setting lib\Map::tx('地址') 騰訊地圖 lib\Map::gaode($address, $show_full = false)高德地圖 ~~~ 最近幾天 ~~~ lib\Time::neerDays($num = 5,$separate = "") ~~~ 返回最近幾月 ~~~ lib\Time::neerMonths($num = 5,$separate = "") ~~~ 返回最近幾年 ~~~ lib\Time::neerYears($num = 5,$separate = "") ~~~ 取今日、本周、本月、本年、昨日、上周、上月、上年 ~~~ lib\Time::get($key, $date_format = false) ~~~ 返回多少歲 ~~~ lib\Time::age($bornUnix) ~~~ 計算時間剩余  ~~~ lib\Time::less_time($a, $b = null) ~~~ 返回圖片信息 ~~~ $file = PATH.'../demos/doc/1.jpg'; $pdf = new \lib\Img($file); //取長寬 print_r($pdf->getWh()); //2是橫版,1是豎版 print_r($pdf->getDimensionsType()); ~~~ 多少時間之前 ~~~ timeago($time) ~~~ 設置配置 ~~~ set_config($title,$body) ~~~ 優先取數據庫,未找到后取配置文件 ~~~ get_config($title) ~~~ XML 轉成 數組 ~~~ xml_to_array($xml) ~~~ 數組轉xml ~~~ array_to_xml($arr) ~~~ AES加密 ~~~ $config['aes_key'] = "123456"; $config['aes_iv'] = md5('app_sun'); $token = urlencode(aes_encode($d)); ~~~ 返回兩個時間點間的日期數組 ~~~ get_dates($start, $end) ~~~ 當前時間是周幾 ~~~ get_current_week($date) ~~~ 多語言翻譯 ~~~ lang('welcome',['name'=>'test'] ) ~~~ 配置文件在 `lang/zh-cn/app.php`中。 搜索替換\n , ,空格。 轉成數組 ~~~ string_to_array($str) ~~~ AES解密 ~~~ $token = $_GET['token']; $token = aes_decode($token); pr($token); ~~~ 根據用戶id查用戶信息 ~~~ get_user($user_id) ~~~ 查用戶信息,where條件 ~~~ get_user_where($where = []) ~~~ 取用戶擴展字段值 ~~~ get_user_meta($user_id) ~~~ 更新用戶的meta信息 ,參數$meta如 ['nickname'=>''] ~~~ set_user_meta($user_id,$meta) ~~~ 獲取HTTP_REFERER ~~~ referer($show_full = false) ~~~ 當前域名 ,結尾帶/ ~~~ host() ~~~ 取用戶擴展字段值 ~~~ get_user_meta_where($where = [],$return_row = false) ~~~ 所有會員 ~~~ get_user_all($where = []) ~~~ 取單個用戶組信息 ~~~ user_group_get($group_id) ~~~ 跳轉 ~~~ jump($url) ~~~ CDN地址,需要在`config.ini.php`配置` $config['cdn_url'] = [];` ~~~ static_url() ~~~ 判斷是命令行下 ~~~ is_cli() ~~~ 判斷是否為json ~~~ is_json($str) ~~~ 數組轉對象 ~~~ array_to_object($arr) ~~~ 對象轉數組 ~~~ object_to_array($obj) ~~~ 取目錄名 ~~~ get_dir($name) ~~~ 取后綴,不包含`.` ~~~ get_ext($name) ~~~ 取文件名 ~~~ get_name($name) ~~~ 創建目錄 ~~~ create_dir($arr = []) ~~~ 取IP ~~~ get_ip() ~~~ 計算兩點地理坐標之間的距離,返回公里數 ~~~ get_distance($longitude1, $latitude1, $longitude2, $latitude2) ~~~ 設置、獲取cookie ~~~ cookie($name, $value = null, $expire = 0, $path = '/') ~~~ 刪除COOKIE ~~~ remove_cookie($name) ~~~ 返回 min="1900-01-01" max="2099-12-31" ~~~ date_limit() ~~~ 路徑列表,支持文件夾下的子所有文件夾 ~~~ get_deep_dir($path) ~~~ 返回成功信息,JSON格式 ~~~ json_success($arr = []) ~~~ 返回錯誤信息,JSON格式 ~~~ json_error($arr = []) ~~~ yaml轉數組,數組轉yaml格式 ~~~ yaml($str) ~~~ 解析xlsx文件 ~~~ $lists = lib\Xls::load($file, [ '產品編號' => 'product_num', '產品規格' => 'name', '注冊證號' => 'cert_num', '單位' => 'unit', ],$column_use_date = []); ~~~ `$column_use_date ` 指定哪幾列是時間格式 xls生成 ~~~ 生成多個worksheet事例: $where = [ 'status' => 1, 'date[>=]' => $start, 'date[<=]' => $end, ]; $title = [ 'invoice_number' => '發票號碼', 'customer_name' => '供應商', 'product_num' => '規格型號', 'num' => '數量', 'price' => '單價', 'total_price' => '金額', ]; //專票 $where['invoice_type'] = 1; $values = invoice_set_xls_data($where,$title); //普票 $where['invoice_type'] = 2; $new_data = invoice_set_xls_data($where,$title); //第一個worksheet Xls::$label = '專票'; Xls::$sheet_width = [ 'A' => "15", 'B' => "36", 'C' => "30", 'D' => "10", 'E' => "10", 'F' => "10", ]; //更多worksheet,如果只是一個,可不用下面代碼,直接跳到Xls::create處 Xls::$works = [ [ 'title' => $title, 'label' => '普票', 'data' => $new_data, 'width' => Xls::$sheet_width, ] ]; Xls::create($title, $values, $name, true); ~~~ 驗證數據 ~~~ $data = g(); $vali = validate([ 'company_title' => '客戶名', 'email' => '郵件地址', 'active_plugins' => '系統', 'exp_time' => '過期時間', ],$data,[ 'required' => [ ['company_title'], ['email'], ['active_plugins'], ['exp_time'], ], 'email'=>[ ['email'] ] ]); if($vali){ json($vali); } ~~~ 規則 ~~~ required - Field is required requiredWith - Field is required if any other fields are present requiredWithout - Field is required if any other fields are NOT present equals - Field must match another field (email/password confirmation) different - Field must be different than another field accepted - Checkbox or Radio must be accepted (yes, on, 1, true) numeric - Must be numeric integer - Must be integer number boolean - Must be boolean array - Must be array length - String must be certain length lengthBetween - String must be between given lengths lengthMin - String must be greater than given length lengthMax - String must be less than given length min - Minimum max - Maximum listContains - Performs in_array check on given array values (the other way round than in) in - Performs in_array check on given array values notIn - Negation of in rule (not in array of values) ip - Valid IP address ipv4 - Valid IP v4 address ipv6 - Valid IP v6 address email - Valid email address emailDNS - Valid email address with active DNS record url - Valid URL urlActive - Valid URL with active DNS record alpha - Alphabetic characters only alphaNum - Alphabetic and numeric characters only ascii - ASCII characters only slug - URL slug characters (a-z, 0-9, -, _) regex - Field matches given regex pattern date - Field is a valid date dateFormat - Field is a valid date in the given format dateBefore - Field is a valid date and is before the given date dateAfter - Field is a valid date and is after the given date contains - Field is a string and contains the given string subset - Field is an array or a scalar and all elements are contained in the given array containsUnique - Field is an array and contains unique values creditCard - Field is a valid credit card number instanceOf - Field contains an instance of the given class optional - Value does not need to be included in data array. If it is however, it must pass validation. arrayHasKeys - Field is an array and contains all specified keys. ~~~ 數組轉tree ~~~ /** * 數組轉tree * * 輸入$list * [ * {id:1,pid:0,其他字段}, * {id:2,pid:1,其他字段}, * {id:3,pid:1,其他字段}, * ] * 輸出 * [ * [ * id:1, * pid:0, * 其他字段, * children:[ * {id:2,pid:1,其他字段}, * {id:3,pid:1,其他字段}, * ] * ] * ] * */ array_to_tree($list, $pk = 'id', $pid = 'pid', $child = 'children', $root = 0, $my_id = '') ~~~
                  <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>

                              哎呀哎呀视频在线观看