一直想要自己搭一个短网址服务,奈何 github 上找过几圈,都没有找到十分符合心意的,于是就趁周末自己写了一个。
Ourls 是一个基于发号加 hash id 实现的短址服务,灵感来源于知乎上关于短址生成算法的一个问题下的讨论,http://www.zhihu.com/question/29270034。
详见:http://blog.skyx.in/archives/183/。
在线演示地址:http://skyx.in/。
github 地址:https://github.com/takashiki/Ourls。
1
Xrong 2015-09-20 17:29:52 +08:00
http://skyx.in/GRv7G 直接 500 错误了
|
2
hinate 2015-09-20 17:34:25 +08:00
http://skyx.in/GRv7G 500 错误
|
3
Tink 2015-09-20 17:36:36 +08:00
正则也有问题,非 url 也能直接缩址
|
6
popok 2015-09-20 17:56:16 +08:00
生成短地址按顺序编号,存入数据库,编号转换成 62 进制( 26 小写, 26 大写, 10 数字)。
还原长地址把 62 进制转 10 进制,进数据库按编号查长地址, 301 跳 |
7
popok 2015-09-20 17:57:28 +08:00
对了,上面是我的思路
|
9
huangtao728 2015-09-20 19:12:27 +08:00 via Android
500 Internal Server Error
Missing argument 1 for {closure}(), called in /data1/www/htdocs/518/ourls/1/vendor/mikecao/flight/flight/core/Dispatcher.php on line 160 and defined (2 ) #0 /data1/www/htdocs/518/ourls/1/app/routes.php (75 ): flight\Engine->handleError (2, 'Missing argumen...', '/data1/www/htdo...', 75, Array ) #1 /data1/www/htdocs/518/ourls/1/vendor/mikecao/flight/flight/core/Dispatcher.php (160 ): {closure}() #2 /data1/www/htdocs/518/ourls/1/vendor/mikecao/flight/flight/core/Dispatcher.php (143 ): flight\core\Dispatcher::callFunction (Object (Closure ), Array ) #3 /data1/www/htdocs/518/ourls/1/vendor/mikecao/flight/flight/core/Dispatcher.php (48 ): flight\core\Dispatcher::execute (Object (Closure ), Array ) #4 /data1/www/htdocs/518/ourls/1/vendor/mikecao/flight/flight/Engine.php (64 ): flight\core\Dispatcher->run ('notFound', Array ) #5 /data1/www/htdocs/518/ourls/1/vendor/mikecao/flight/flight/Engine.php (324 ): flight\Engine->__call ('notFound', Array ) #6 /data1/www/htdocs/518/ourls/1/vendor/mikecao/flight/flight/Engine.php (324 ): flight\Engine->notFound () #7 /data1/www/htdocs/518/ourls/1/vendor/mikecao/flight/flight/core/Dispatcher.php (191 ): flight\Engine->_start () #8 /data1/www/htdocs/518/ourls/1/vendor/mikecao/flight/flight/core/Dispatcher.php (142 ): flight\core\Dispatcher::invokeMethod (Array, Array ) #9 /data1/www/htdocs/518/ourls/1/vendor/mikecao/flight/flight/core/Dispatcher.php (48 ): flight\core\Dispatcher::execute (Array, Array ) #10 /data1/www/htdocs/518/ourls/1/vendor/mikecao/flight/flight/Engine.php (64 ): flight\core\Dispatcher->run ('start', Array ) #11 /data1/www/htdocs/518/ourls/1/vendor/mikecao/flight/flight/core/Dispatcher.php (191 ): flight\Engine->__call ('start', Array ) #12 /data1/www/htdocs/518/ourls/1/vendor/mikecao/flight/flight/core/Dispatcher.php (191 ): flight\Engine->start () #13 /data1/www/htdocs/518/ourls/1/vendor/mikecao/flight/flight/Flight.php (65 ): flight\core\Dispatcher::invokeMethod (Array, Array ) #14 /data1/www/htdocs/518/ourls/1/public/index.php (18 ): Flight::__callStatic ('start', Array ) #15 /data1/www/htdocs/518/ourls/1/public/index.php (18 ): Flight::start () #16 {main} 应该禁止缩短 skyx.in 。 404 页面也该改一改。 |
10
takashiki OP @huangtao728 嗯,是的,刚刚改了, 500 我也改下
|
11
kfll 2015-09-20 19:38:17 +08:00 via iPhone
|
12
huangtao728 2015-09-20 19:45:41 +08:00 via Android
|
13
takashiki OP @huangtao728 ok
|
14
sobigfish 2015-09-20 20:02:51 +08:00
哟,发现 bug 了
https://www.v2ex.com/t/222201#reply13 https://www.v2ex.com/t/222201#reply14 你说这 2 个 url 一样不呢? |
16
hinate 2015-09-20 21:56:02 +08:00 via Android
我那个短连是好了,但我当时是填的百度的地址,现在打开是不对的,难道当时我和一楼填的地址不一样生成的确实一样的?
|
17
takashiki OP @hinate 你是啥时候生成的,我一开始发出来的时候不知道是有人刷还是爬虫刷,刷了接近一万条记录,我就把之前的全清掉了。
|
19
GPU 2015-09-20 22:15:00 +08:00
昨天的 wwurl 很漂亮
|
22
ob 2015-09-20 22:50:49 +08:00
|
23
welly 2015-09-20 22:52:20 +08:00
各位技术大牛:
我在想有没有这种功能,短网址能不能撤销其指向的功能,使其链接指向失效啊。类似默认开启,手动撤销 |
26
czb 2015-09-21 02:42:00 +08:00 via Android
|
29
jedyu 2015-09-21 16:16:38 +08:00
http://skyx.in/Vydr1
确实不被遍历这个挺好的 |
32
50vip 2015-11-13 18:35:22 +08:00
很赞,我用这个开源搭建了一个 http://xo2.cn/ ,感谢开源~
|
33
initdrv 2017-12-29 17:03:53 +08:00
感谢分享!已经搭建成功。再次感谢大佬开源!😉
|