This article mainly and we introduce how PHP obtains the current host, domain name, url, path, port and other parameters, with a certain reference value, interested can understand, hope to help everyone.
Lab Environment:
Test the domain name
This article is mainly to share with you PHP a useful function parse_url, especially convenient for the analysis of information grabbing, hope to help everyone.
Code
$url = "http://www.electrictoolbox.com/php-extract-domain-from-full-url/"; $parts =
A useful function in PHP, parse_url, is especially convenient for information capture analysis. For example:
The code is as follows:
$ Url = "http://www.electrictoolbox.com/php-extract-domain-from-full-url ";$ Parts = parse_url ($ url );
Output:
This article mainly introduces how PHP obtains the current host, domain name, url, path, port and other parameters, has a certain reference value, interested can understand the next
Lab Environment:
Test the domain name Daxiangtravel.com,apache
Good morning. may I ask friends about the absolute path of php? The New Day is so cool.
The younger brother has a question.
Define ('host', 'http: // '. $ _ SERVER ['http _ host'].'/');
I want to use absolute paths both locally and on the server,
Get domain name or host address
echo $_server[' Http_host ']. "";
Get web Address
echo $_server[' php_self ']. "";
Get URL parameters
echo $_server["Query_string"]. "";
Get user Agent
echo $_server['
alert (location.hash);//nullalert (location.host);//return server name and port numberalert (location.hostname);//returns the server name without a port numberalert (location.href);//returns the full URL of the currently loaded pageAlert
PHP is a useful function parse_url, especially convenient for information retrieval analysis, for example, as follows:$url = "http://www.electrictoolbox.com/php-extract-domain-from-full-url/"$parts Parse_url($urlOutput:Array== Www.electrictoolbox.
Build a simple test environmentWhat is the response headerThe simplest response header--content-typeSetting the response headerRequest redirection and Response headerView response Headers in the browser1, first quickly build a simple test
Previous wordsIn the HTTP section, the knowledge of the URL is described in detail. The URL module in Nodejs provides some useful functions for URL processing and parsing. This article describes the URLs in Nodejs in detailURL ObjectThe parse URL
$array =array ( ‘id‘ =123, ‘name‘ = ‘dopost‘ );echo http_build_query( $array );//得到结果id=123name=dopostExamples are as follows: The copy code code is as follows: $url="http://www.electrictoolbox.com/php-extract-domain-from-full-url/";
Http://www.cnblogs.com/meil/archive/2006/06/28/437527.html This article lists various JavaScript objects and arrays, including a short description of the work done by each of these objects or arrays. As well as its associated property methods, as
Weather forecast interface in the Web page application of many, generally in the Discuz website open backstage can be added, but how to implement the programming language?can apply to SMARTWEATHERAPI weather the use of the interface, began to start
Learn and create a simple crawler in the web, crawl Baidu Wikipedia related terms informationA third-party parsing package (BEAUTIFULSOUP4) is used in the program, and the installation command in the Windows environment: Pip Install BEAUTIFULSOUP41.
Links are also implemented through elements (element). It takes only one element and one attribute to do the link. Here is an example of a link to jinanwangzhanjianshe.com:
Example 1:
This is a link to jinanwangzhanjianshe.com
This example
Javascript| Reference | objects | arrays
JavaScript objects and Array Reference encyclopediaThis article enumerates a variety of JavaScript objects and arrays, along with a brief description of the work done on each of these objects or arrays, and
#测试网址: http://localhost/blog/testurl.php?id=5
Copy Code code as follows:
Get domain name or host address
echo $_server[' Http_host ']. " "; #localhost
Get Web page address
echo $_server[' php_self ']. " ";
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.