<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智能體構建引擎,智能編排和調試,一鍵部署,支持知識庫和私有化部署方案 廣告
                ~~~ // 移除HTML標簽 $this->request->filter('trim,strip_tags,htmlspecialchars'); ~~~ ~~~ if (!function_exists('is_really_writable')) { /** * 判斷文件或文件夾是否可寫 * @param string $file 文件或目錄 * @return bool */ function is_really_writable($file) { if (DIRECTORY_SEPARATOR === '/') { return is_writable($file); } if (is_dir($file)) { $file = rtrim($file, '/') . '/' . md5(mt_rand()); if (($fp = @fopen($file, 'ab')) === false) { return false; } fclose($fp); @chmod($file, 0777); @unlink($file); return true; } elseif (!is_file($file) or ($fp = @fopen($file, 'ab')) === false) { return false; } fclose($fp); return true; } } ~~~ ~~~ if (!function_exists('rmdirs')) { /** * 刪除文件夾 * @param string $dirname 目錄 * @param bool $withself 是否刪除自身 * @return boolean */ function rmdirs($dirname, $withself = true) { if (!is_dir($dirname)) { return false; } $files = new RecursiveIteratorIterator( new RecursiveDirectoryIterator($dirname, RecursiveDirectoryIterator::SKIP_DOTS), RecursiveIteratorIterator::CHILD_FIRST ); foreach ($files as $fileinfo) { $todo = ($fileinfo->isDir() ? 'rmdir' : 'unlink'); $todo($fileinfo->getRealPath()); } if ($withself) { @rmdir($dirname); } return true; } } ~~~ ~~~ if (!function_exists('copydirs')) { /** * 復制文件夾 * @param string $source 源文件夾 * @param string $dest 目標文件夾 */ function copydirs($source, $dest) { if (!is_dir($dest)) { mkdir($dest, 0755, true); } foreach ( $iterator = new RecursiveIteratorIterator( new RecursiveDirectoryIterator($source, RecursiveDirectoryIterator::SKIP_DOTS), RecursiveIteratorIterator::SELF_FIRST ) as $item ) { if ($item->isDir()) { $sontDir = $dest . DS . $iterator->getSubPathName(); if (!is_dir($sontDir)) { mkdir($sontDir, 0755, true); } } else { copy($item, $dest . DS . $iterator->getSubPathName()); } } } } ~~~ ~~~ if (!function_exists('check_cors_request')) { /** * 跨域檢測 */ function check_cors_request() { if (isset($_SERVER['HTTP_ORIGIN']) && $_SERVER['HTTP_ORIGIN']) { $info = parse_url($_SERVER['HTTP_ORIGIN']); // localhost,127.0.0.1 $domainArr = explode(',', config('fastadmin.cors_request_domain')); $domainArr[] = request()->host(true); if (in_array("*", $domainArr) || in_array($_SERVER['HTTP_ORIGIN'], $domainArr) || (isset($info['host']) && in_array($info['host'], $domainArr))) { header("Access-Control-Allow-Origin: " . $_SERVER['HTTP_ORIGIN']); } else { $response = Response::create('跨域檢測無效', 'html', 403); throw new HttpResponseException($response); } header('Access-Control-Allow-Credentials: true'); header('Access-Control-Max-Age: 86400'); if ($_SERVER['REQUEST_METHOD'] == 'OPTIONS') { if (isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_METHOD'])) { header("Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS"); } if (isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS'])) { header("Access-Control-Allow-Headers: {$_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS']}"); } $response = Response::create('', 'html'); throw new HttpResponseException($response); } } } } ~~~ ``` // 生成隨機字符串 function generate_rand($l){ $c= "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; srand((double)microtime()*1000000); for($i=0; $i < $l; $i++) { $rand.= $c[rand()%strlen($c)]; } return $rand; } ``` ``` // 郵箱驗證 function is_valid_email($email, $test_mx = false) { if(eregi("^([_a-z0-9-]+)(\.[_a-z0-9-]+)*@([a-z0-9-]+)(\.[a-z0-9-]+)*(\.[a-z]{2,4})$", $email)) if($test_mx) { list($username, $domain) = split("@", $email); return getmxrr($domain, $mxrecords); } else return true; else return false; } ``` ~~~ if (!function_exists('get_zodiac_sign')) { /** * 根據月、日獲取星座 * * @param unknown $month 月 * @param unknown $day 日 * @return boolean|multitype: * @author 牧羊人 * @date 2020-04-21 */ function get_zodiac_sign($month, $day) { // 檢查參數有效性 if ($month < 1 || $month > 12 || $day < 1 || $day > 31) { return false; } // 星座名稱以及開始日期 $signs = array( array("20" => "水瓶座"), array("19" => "雙魚座"), array("21" => "白羊座"), array("20" => "金牛座"), array("21" => "雙子座"), array("22" => "巨蟹座"), array("23" => "獅子座"), array("23" => "處女座"), array("23" => "天秤座"), array("24" => "天蝎座"), array("22" => "射手座"), array("22" => "摩羯座") ); list($sign_start, $sign_name) = each($signs[(int)$month - 1]); if ($day < $sign_start) { list($sign_start, $sign_name) = each($signs[($month - 2 < 0) ? $month = 11 : $month -= 2]); } return $sign_name; } } ~~~ ~~~ if (!function_exists('get_device_type')) { /** * 獲取設備類型(蘋果或安卓) * @return int 返回結果 * @author 牧羊人 * @date 2020-04-21 */ function get_device_type() { // 全部變成小寫字母 $agent = strtolower($_SERVER['HTTP_USER_AGENT']); $type = 0; // 分別進行判斷 if (strpos($agent, 'iphone') !== false || strpos($agent, 'ipad') !== false) { $type = 1; } if (strpos($agent, 'android') !== false) { $type = 2; } return $type; } } ~~~ ~~~ if (!function_exists('get_ip_city')) { /** * 根據IP獲取城市 * @param string $ip IP地址 * @return bool|mixed|string * @author 牧羊人 * @since 2021/9/23 */ function get_ip_city($ip = '') { if (empty($ip)) { return '請輸入IP地址'; } $res = @file_get_contents('http://whois.pconline.com.cn/ipJson.jsp?json=true&ip=' . $ip); if (empty($res)) { return ""; } return isset($res['city']) ? $res['city'] : ""; } } ~~~ ~~~ if (!function_exists('is_email')) { /** * 判斷是否為郵箱 * @param string $str 郵箱 * @return false 返回結果true或false * @author 牧羊人 * @date 2020-04-21 */ function is_email($str) { return preg_match('/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/', $str); } } if (!function_exists('is_mobile')) { /** * 判斷是否為手機號 * @param string $mobile 手機號碼 * @return false 返回結果true或false * @author 牧羊人 * @date 2020-04-21 */ function is_mobile($mobile) { // return preg_match('/^1(3|4|5|6|7|8|9)\d{9}$/', $mobile); return preg_match('/^1[3456789]{1}\d{9}$/', $mobile); } } if (!function_exists('is_zipcode')) { /** * 驗證郵編是否正確 * @param string $code 郵編 * @return false 返回結果true或false * @author 牧羊人 * @date 2020-04-21 */ function is_zipcode($code) { return preg_match('/^[1-9][0-9]{5}$/', $code); } } if (!function_exists('is_idcard')) { /** * 驗證身份證是否正確 * @param string $idno 身份證號 * @return bool 返回結果true或false * @author 牧羊人 * @date 2020-04-21 */ function is_idcard($idno) { $idno = strtoupper($idno); $regx = '/(^\d{15}$)|(^\d{17}([0-9]|X)$)/'; $arr_split = array(); if (!preg_match($regx, $idno)) { return false; } // 檢查15位 if (15 == strlen($idno)) { $regx = '/^(\d{6})+(\d{2})+(\d{2})+(\d{2})+(\d{3})$/'; @preg_match($regx, $idno, $arr_split); $dtm_birth = "19" . $arr_split[2] . '/' . $arr_split[3] . '/' . $arr_split[4]; if (!strtotime($dtm_birth)) { return false; } else { return true; } } else { // 檢查18位 $regx = '/^(\d{6})+(\d{4})+(\d{2})+(\d{2})+(\d{3})([0-9]|X)$/'; @preg_match($regx, $idno, $arr_split); $dtm_birth = $arr_split[2] . '/' . $arr_split[3] . '/' . $arr_split[4]; // 檢查生日日期是否正確 if (!strtotime($dtm_birth)) { return false; } else { // 檢驗18位身份證的校驗碼是否正確。 // 校驗位按照ISO 7064:1983.MOD 11-2的規定生成,X可以認為是數字10。 $arr_int = array(7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2); $arr_ch = array('1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2'); $sign = 0; for ($i = 0; $i < 17; $i++) { $b = (int)$idno{ $i}; $w = $arr_int[$i]; $sign += $b * $w; } $n = $sign % 11; $val_num = $arr_ch[$n]; if ($val_num != substr($idno, 17, 1)) { return false; } else { return true; } } } } } ~~~ ~~~ if (!function_exists('is_image')) { /** * 判斷是否為圖片格式 * @param $filename * @return bool|false|int * @author 牧羊人 * @since 2021/7/10 */ function is_image($filename) { $types = '.gif|.GIF|.jpg|.JPG|.jpeg|.JPEG|.png|.PNG|.bmp|.BMP'; //定義檢查的圖片類型 if (file_exists($filename)) { $info = getimagesize($filename); $ext = image_type_to_extension($info['2']); return stripos($types, $ext); } else { return false; } } } ~~~ ~~~ if (!function_exists('mkdirs')) { /** * 遞歸創建目錄 * @param string $dir 需要創建的目錄路徑 * @param int $mode 權限值 * @return bool 返回結果true或false * @author 牧羊人 * @date 2020-04-21 */ function mkdirs($dir, $mode = 0777) { if (is_dir($dir) || mkdir($dir, $mode, true)) { return true; } if (!mkdirs(dirname($dir), $mode)) { return false; } return mkdir($dir, $mode, 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>

                              哎呀哎呀视频在线观看