Super simple code for php short URL
System environment:
php, apache2, linux
Operation to generate php short URL:
Copy the code to index.php and put it in a folder name with only 1 character (such as u) in the secondary directory.
Add write permissions to this directory. To save trouble, just chmod 777 u (the root directory is also OK, you may need to change the code to avoid affecting other files)
The URL generation result:
Put http://www.heimaolianmeng.com/ heimaoseojishu/ becomes http://127.0.0.1/u/1
The principle of php generating short URL:
1. Get the url to be shortened through form post
2. Put the url in a javascript and write it to the file. Names grow by numbers. The function of javascript is to jump to the specified url
Optimization:
If you can set a second-level domain name, just point the second-level domain name to that directory, and there is no need to enter an extra u/.
Code:
Code example:
What versions of linux system are there?
How to read macro control data in javascript
What are the methods of executing Shell scripts?
Which company does Android system belong to?
How to open vcf file in windows
Introduction to java core technology content
What is LAN
What does the rm-rf command mean in linux?