Home  >  Article  >  Backend Development  >  Optimization method of php URL

Optimization method of php URL

怪我咯
怪我咯Original
2017-07-12 14:45:331460browse

URL is a Uniform Resource Locator (URL, the abbreviation of English Uniform Resource Locator), also known as a web page address, which is the address of a standard resource on the Internet. It was originally invented by Tim Berners-Lee as an address for the World Wide Web. It has now been compiled as the Internet standard RFC1738 by the World Wide Web Consortium. It is an identification method used to completely describe the addresses of web pages and other resources on the Internet. Every web page on the Internet has a unique name identifier, usually called a URL address. This address can be a local disk, a computer on the LAN, or more often a site on the Internet. Simply put, a URL is a Web address, commonly known as a "website address." A set of URI schemes that contain explicit instructions on how to access resources on the Internet. URLs are uniform because they use the same basic syntax, regardless of the specific type of resource addressed (a web page, a newsgroup) or the mechanism by which the resource is obtained. When processing address URLs, you can use this function to easily connect words with "-"

The code is as follows:

function getSeoVersion($phrase) { 
return preg_replace('/[^a-z0-9_-]/i', '', strtolower(str_replace(' ', '-', trim($phrase)))); 
} 

// example usage: 
echo getSeoVersion("German cars are amazing.");


The above is the detailed content of Optimization method of php URL. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn