thinkphp5.0 Get URL Information

Source: Internet
Author: User

Get URL Information
$request = Request::instance ();Get current domain nameEcho' Domain: '. $request->domain ().' <br/> ';Get Current Portal FileEcho' File: '. $request->basefile ().' <br/> ';Get current URL address without domain nameEcho' URL: '. $request->url ().' <br/> ';Get the full URL address that contains the domain nameEcho' URL with domain: '. $request->url (true).' <br/> ';Get current URL address does not contain query_stringEcho' URL without query: '. $request->baseurl ().' <br/> ';Gets the root address of the URL accessEcho' Root: '. $request->root ().' <br/> '; //Get the root address of the URL access echo ' root with domain: '. $request->root (true). ' <br/> '; //Get the Path_info information in the URL address echo ' pathinfo: '. $request->pathinfo (). ' <br/> '; //Get the Path_info information in the URL address without the suffix echo ' pathinfo: '. $request->path (). ' <br/> '; //Get the suffix information in the URL address echo ' ext: '. $request->ext (). ' <br/> ';


The output is:

domain: http://tp5.comfile: /index.phpurl: /index/index/hello.html?name=thinkphpurl with domain: http://tp5.com/index/index/hello.html?name=thinkphpurl without query: /index/index/hello.htmlroot:root with domain: http://tp5.compathinfo: index/index/hello.htmlpathinfo: index/index/helloext: html
 &NBSP;   

thinkphp5.0 Get URL information

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.