This section: Details thinkphp URL rules, url pseudo-static, url routing, url rewriting, url generation one, URL rules 1, default is case-sensitive , 2, if we do not want to be case-sensitive can be changed to config fil
PHP short URL Super simple code
System environment:
Php,apache2,linux
To generate the PHP short URL operation:
Copy the code to index.php in a two-level directory with only 1 characters (such as U) as the folder name.
To add write permissions for this directory, the diagram chmod 777 U (root directory also line, in order to avoid affecting other files may have to change the code)
JavaScript implementations:
Top.location.href the address of the top-level windowThis.location.href the address of the current window
PHP Implementation:
Get domain name or host addressecho $_server[' Http_host ']. "”; #localhost
Get web Addressecho $_server[' php_self ']. "”; #/blog/testurl.php
Get URL parametersecho $_server["Query_string"]. "”; #id =5
Get user Agentecho $_server[' Http_referer ']. "”;
Get the full URLEcho ' http://'.
SerV
First, PHP gets the URL of the current page:
Copy the Code code as follows:
Get the current script URLfunction Getcururl (){if (!empty ($_server["Request_uri")){$scriptName = $_server["Request_uri"];$nowurl = $scriptName;}Else{$scriptName = $_server["Php_self"];if (Empty ($_server["query_string"])){$nowurl = $scriptName;}Else{$nowurl = $scriptName. "?". $_server["Query_string"];}}return $nowurl;}
The other is the value of a variable in the query sect
C # URL short address compression algorithm and short URL Principle example, detailed introduction of the short URL mapping algorithm, the long URL MD5 generated 32-bit signature string, divided into 4 segments, 8 bytes per segment, and then generate a short URL, see text ex
Seo friends now know the importance of URL static, URL pseudo static, and URL rewriting to Seo. Search Engines like static website pages. Today, we will analyze in detail the differences among static URLs, pseudo-static URLs, and URL rewriting.
Static URL. Static
URL rewriting is the process of intercepting incoming Web requests and automatically redirecting requests to other URLs.For example, if the browser sends a request for hostname/101. aspx, the server automatically directs the request to http: // hostname/list. aspx? Id = 101.Url rewriting has the following advantages:Shorten the url and hide the actual path to imp
This article transferred from: http://blog.csdn.net/chendi1985/article/details/5291773Window.location method Get URLUniform Resource Locator (Uniform Resource Locator, URL)The complete URL consists of the following parts:Scheme://host:port/path?query#fragmentScheme: Communication protocolCommon Http,ftp,maito, etc.Host: HostsThe server (computer) domain Name System (DNS) hostname or IP address.Port: Port nu
The following describes how to add url parameters to a url and change the url parameters: javascritpurl
The url parameter method is used to add parameters to the url. If the original url contains the parameters, it will be overwri
Add the url parameter to the url, and then add the parameter to the url.
Add object parameters to the url. If the original url contains parametersJs Code
function addToUrl(obj){ var aprotocol = location.protocol; var ahost = location.host; var apath = location.pathname; var
What is HTTP? Hypertext Transfer Protocol (Hypertext Transfer Protocol-HTTP) is a protocol designed to enable clients and servers to communicate smoothly.HTTP works with Request-response protocol (Request-reply protocol) between the client and the server. Get-gets data from the specified server post-submits data to the specified server to handle the GET method: When using the Get method, the query string (key-value pair) is appended to the URL address
This article describes how to parse a url in php, obtain url parameters, and obtain url parameters in four ways. It involves converting string parameters into arrays and converting parameters into strings, the code in this article is easy to understand. If you are interested, let's take a look at the following code: php parses the
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.