首页
📷在线壁纸
🎬娱乐天地
🔖友情链接
更多
📝留言板
Search
1
【javascript】JS-向当前url追加参数
2,345 阅读
2
【PHP】生成随机昵称
2,219 阅读
3
【PHP】判断一个字符串是否属于序列化后的数据
2,026 阅读
4
【css】html+css给文章页,做阅读全文
1,975 阅读
5
【PHP】 设计模式(23种)
1,913 阅读
📂默认分类
💓typecho
🏳️🌈代码改变世界
🍇 mysql
🍈 Winform
🍓 golang
🍉 设计模式
🥝 PHP
🍎 python
🍊 nginx
🍋 网络安全
🍍 javascript
🫑 database
🍭文艺范
🍏mac
AI
LLM
stableDiffusion
TTS
yolo
3D
code
comfyui
ASR
登录
Search
标签搜索
php
typecho
代码注释
redis
mysql
go
golang
nginx
thinkphp
docker
gin
linux
curl
html
mamp
算法
短网址
构造函数
webhook
代码片段
依然范儿特西
累计撰写
150
篇文章
累计收到
1
条评论
首页
栏目
📂默认分类
💓typecho
🏳️🌈代码改变世界
🍇 mysql
🍈 Winform
🍓 golang
🍉 设计模式
🥝 PHP
🍎 python
🍊 nginx
🍋 网络安全
🍍 javascript
🫑 database
🍭文艺范
🍏mac
AI
LLM
stableDiffusion
TTS
yolo
3D
code
comfyui
ASR
页面
📷在线壁纸
🎬娱乐天地
🔖友情链接
📝留言板
搜索到
150
篇与
的结果
2019-05-31
【PHP】短网址生成算法
源码如下<?php //短网址生成算法 class ShortUrl { //字符表 public static $charset = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; public static $main_host = "http://t.cn/"; //可以自定义 public static function encode($url) { $key = 'abc'; //加盐 $urlhash = md5($key . $url); $len = strlen($urlhash); //将加密后的串分成4段,每段4字节,对每段进行计算,一共可以生成四组短连接 for ($i = 0; $i < 4; $i++) { $urlhash_piece = substr($urlhash, $i * $len / 4, $len / 4); //将分段的位与0x3fffffff做位与,0x3fffffff表示二进制数的30个1,即30位以后的加密串都归零 //此处需要用到hexdec()将16进制字符串转为10进制数值型,否则运算会不正常 $hex = hexdec($urlhash_piece) & 0x3fffffff; //域名根据需求填写 $short_url = self::$main_host; //生成6位短网址 for ($j = 0; $j < 6; $j++) { //将得到的值与0x0000003d,3d为61,即charset的坐标最大值 $short_url .= self::$charset[$hex & 0x0000003d]; //循环完以后将hex右移5位 $hex = $hex >> 5; } $short_url_list[] = $short_url; } return $short_url_list; } } $url = "https://www.jb51.net/article/92541.htm"; $short = ShortUrl::encode($url); echo "<pre>"; print_r($short); ?>
2019年05月31日
1,087 阅读
0 评论
0 点赞
2019-03-29
小动物的注释
上图 /* _.'__ `. .--($)($$)---/#\ .' @ /###\ : , ##### `-..__.-' _.-\###/ `;_: `"' .'"""""`. /, ya ,\\ // 404! \\ `-._______.-' ___`. | .'___ (______|______) */ /* .--, .--, ( ( \.---./ ) ) '.__/o o\__.' {= ^ =} > - < / \ // \\ //| . |\\ "'\ /'"_.-~^`'-. \ _ /--' ` ___)( )(___ (((__) (__))) 高山仰止,景行行止.虽不能至,心向往之。 */
2019年03月29日
1,067 阅读
0 评论
1 点赞
2019-02-15
【PHP】中文姓名->改为星号
<?php header("Content-type: text/html; charset=utf-8"); $str = "老李"; echo substr_cut($str); function substr_cut($user_name){ $strlen = mb_strlen($user_name, 'utf-8'); $firstStr = mb_substr($user_name, 0, 1, 'utf-8'); $lastStr = mb_substr($user_name, -1, 1, 'utf-8'); return $strlen == 2 ? $firstStr . str_repeat('*', mb_strlen($user_name, 'utf-8') - 1) : $firstStr . str_repeat("*", $strlen - 2) . $lastStr; }
2019年02月15日
1,434 阅读
0 评论
0 点赞
2019-01-22
女孩子注释
上代码/** * .::::. * .::::::::. * ::::::::::: FUCK YOU * ..:::::::::::' * '::::::::::::' * .:::::::::: * '::::::::::::::.. * ..::::::::::::. * ``:::::::::::::::: * ::::``:::::::::' .:::. * ::::' ':::::' .::::::::. * .::::' :::: .:::::::'::::. * .:::' ::::: .:::::::::' ':::::. * .::' :::::.:::::::::' ':::::. * .::' ::::::::::::::' ``::::. * ...::: ::::::::::::' ``::. * ```` ':. ':::::::::' ::::.. * '.:::::' ':'````.. */
2019年01月22日
1,229 阅读
0 评论
0 点赞
2019-01-22
键盘注释
看源码/** * ┌───┐ ┌───┬───┬───┬───┐ ┌───┬───┬───┬───┐ ┌───┬───┬───┬───┐ ┌───┬───┬───┐ * │Esc│ │ F1│ F2│ F3│ F4│ │ F5│ F6│ F7│ F8│ │ F9│F10│F11│F12│ │P/S│S L│P/B│ ┌┐ ┌┐ ┌┐ * └───┘ └───┴───┴───┴───┘ └───┴───┴───┴───┘ └───┴───┴───┴───┘ └───┴───┴───┘ └┘ └┘ └┘ * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ ┌───┬───┬───┐ ┌───┬───┬───┬───┐ * │~ `│! 1│@ 2│# 3│$ 4│% 5│^ 6│& 7│* 8│( 9│) 0│_ -│+ =│ BacSp │ │Ins│Hom│PUp│ │N L│ / │ * │ - │ * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ ├───┼───┼───┤ ├───┼───┼───┼───┤ * │ Tab │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │{ [│} ]│ | \ │ │Del│End│PDn│ │ 7 │ 8 │ 9 │ │ * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┤ └───┴───┴───┘ ├───┼───┼───┤ + │ * │ Caps │ A │ S │ D │ F │ G │ H │ J │ K │ L │: ;│" '│ Enter │ │ 4 │ 5 │ 6 │ │ * ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────────┤ ┌───┐ ├───┼───┼───┼───┤ * │ Shift │ Z │ X │ C │ V │ B │ N │ M │< ,│> .│? /│ Shift │ │ ↑ │ │ 1 │ 2 │ 3 │ │ * ├─────┬──┴─┬─┴──┬┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ ┌───┼───┼───┐ ├───┴───┼───┤ E││ * │ Ctrl│ │Alt │ Space │ Alt│ │ │Ctrl│ │ ← │ ↓ │ → │ │ 0 │ . │←─┘│ * └─────┴────┴────┴───────────────────────┴────┴────┴────┴────┘ └───┴───┴───┘ └───────┴───┴───┘ */
2019年01月22日
1,098 阅读
0 评论
0 点赞
2019-01-21
【redis】redis 单机锁 和 分布式锁
单机锁
2019年01月21日
1,256 阅读
0 评论
1 点赞
2019-01-18
【PHP】常用的验证类
验证是否为微信浏览器function IsWechat() { $agent = isset($_SERVER['HTTP_USER_AGENT']) ? strtolower($_SERVER['HTTP_USER_AGENT']) : null; return (strpos($agent, 'micromessenger') !== false); }
2019年01月18日
1,435 阅读
0 评论
0 点赞
2019-01-18
【PHP】php原生生成word、execl文件
生成word文件 /*** * 生成word文件 ***/ header("Content-Type: application/msword"); header("Content-Disposition: attachment; filename=doc.doc"); header("Pragma: no-cache"); header("Expires: 0"); $output = '<table border="1" cellspacing="2" cellpadding="2" width="90%" align="center">'; $output .= '<tr bgcolor="#cccccc"><td align="center">图片</td></tr>'; $output .= '<tr bgcolor="#f6f7fa"><td><span style="color:#FF0000;"><strong>下面是一张图片</strong></span& gt;</td></tr>'; $output .= '<tr><td align="center"><img src="http://zi.csdn.net/48260_2.gif"></td></tr>'; $output .= '</table>'; echo $output;
2019年01月18日
1,047 阅读
0 评论
0 点赞
2019-01-18
【php】全角转半角
封装方法
2019年01月18日
1,354 阅读
0 评论
0 点赞
2019-01-18
【PHP】获取收集相关信息
封装方法
2019年01月18日
1,676 阅读
0 评论
0 点赞
1
...
13
14
15