项目
在 GitHub 查看
briancray/PHP-URL-Shortener
briancray/PHP-URL-Shortener has 578 GitHub stars and 215 forks. GitHot measured 0 stars in 24 hours and 0 in 7 days. Last checked 2026-11-21 17:13 UTC. Last push 2018-11-28.
实测星标增长
- 24小时
- 0
- 7天
- 0
- 15天
- 正在收集历史
- 1个月
- 正在收集历史
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
关于
公开 GitHub 仓库
开发工具README.md
原文License: http://www.gnu.org/licenses/gpl-2.0.html
Benefits
- Can shorten over 42 billion unique URLs in 6 or less characters (it can do more than 12,000,000 in only 4!)
- Super duper fast—uses very little server resources
- Includes an API so you can create your own short URLs on the fly
- Option to turn clickthru tracking on and off
- Option to limit usage to 1 IP address for personal use and to prevent spamming from others
- Only uses alphanumeric characters so all browsers can interpret the URL
- Secure—several data filters in place to prevent SQL injection hacks
- Option to check if the URL is real (doesn’t respond with a 404) before shortening
- Uses 301 redirects for SEO and analytics yumminess
- Option to store a local cache to prevent database queries on every redirect
- Option to change the characters allowed in a shortened url
Installation
- Make sure your server meets the requirements: a) Optionally you can run this from your current domain or find a short domain b) Apache c) PHP d) MySQL e) Access to run SQL queries for installation
- Download a .zip file of the PHP URL shortener script files
- Upload the contents of the .zip file to your web server
- Update the database info in config.php
- Run the SQL included in shortenedurls.sql. Many people use phpMyAdmin for this, if you can’t do it yourself contact your host.
- Rename rename.htaccess to .htaccess
- If you want to use the caching option, create a directory named cache with permissions 777
Using your personal URL shortener service
- To manually shorten URLs open in your web browser the location where you uploaded the files.
- To programmatically shorten URLs with PHP use the following code: $shortenedurl = file_get_contents('http://yourdomain.com/shorten.php?longurl=' . urlencode('http://' . $_SERVER['HTTP_HOST'] . '/' . $_SERVER['REQUEST_URI']));
探索相关项目
加载中…