Skip to content

Commit

Permalink
fix some bugs, adaptive to php8.1 version.
Browse files Browse the repository at this point in the history
  • Loading branch information
tominysun committed Apr 13, 2023
1 parent 484c2a7 commit 4ab7283
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
3 changes: 1 addition & 2 deletions create.php
Expand Up @@ -53,8 +53,7 @@
exit();
}
//判断是否正则为正确的网址
$regex = "/^(https?:\/\/)([\w-]+\.)+[\w-]+(\/[\w-.\/?%&=#]*)?$/i";
if (!preg_match($regex, $url)) {
if (filter_var($url, FILTER_VALIDATE_URL) == false) {
$message = '请输入正确的URL地址';
echo json_encode(array('code' => 8002, 'message' => $message));
exit();
Expand Down
7 changes: 4 additions & 3 deletions function.php
Expand Up @@ -3,8 +3,8 @@
/**
* @Author: Ding Jianlong
* @Date: 2019-03-20 22:40:10
* @Last Modified by: Ding Jianlong
* @Last Modified time: 2019-03-20 23:52:20
* @Last Modified by: Tominysun
* @Last Modified time: 2023-04-10 22:14:32
*/


Expand Down Expand Up @@ -66,7 +66,8 @@ function createId($len){
$str = 'abcdefghijklmnopqrstuvwxyz0123456789';
$key = '';
for($i = 0;$i < $len;$i++){
$key .= $str{mt_rand(0,strlen($str)-1)};
$key .= $str[mt_rand(0,strlen($str)-1)];
//$key .= $str{mt_rand(0,strlen($str)-1)};php7.4以后弃用花括号数组写法
}
return $key;
}
Expand Down

0 comments on commit 4ab7283

Please sign in to comment.