In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
Editor to share with you how to get url from php without parameters. I hope you will get something after reading this article. Let's discuss it together.
Php access url and no parameters: 1, through "$_ SERVER ['HTTP_HOST']" to obtain the domain name or host address; 2, through "$_ SERVER [' PHP_SELF']" to obtain the web address.
This article operating environment: windows7 system, PHP7.1 version, DELL G3 computer
How does php get url and no parameters?
Test URL:
Http://afish.cnblogs.com/p/3941211.html?id=1
The PHP code is implemented as follows:
/ / get the domain name or host address echo $_ SERVER ['HTTP_HOST']. ""; # afish.cnblogs.com// get the web address echo $_ SERVER [' PHP_SELF']. ""; # / p/3941211.html// get the URL parameter echo $_ SERVER ["QUERY_STRING"]. ""; # id=1// get the user agent echo $_ SERVER ['HTTP_REFERER']. " / / get the complete urlecho 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];echo' http://'.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'].'?'.$_SERVER['QUERY_STRING']; # http://afish.cnblogs.com/p/3941211.html?id=1// 's full urlecho 'http://'.$_SERVER['SERVER_NAME'].':'.$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];#http://afish.cnblogs.com:80/p/3941211.html?id=1// with port number takes only the path $url=' http://'.$_SERVER['SERVER_NAME'].$_SERVER["REQUEST_URI"]; Echo dirname ($url); # http://afish.cnblogs.com/p has finished reading this article. I believe you have some understanding of "how to get url without parameters by php". If you want to know more about it, please follow the industry information channel. Thank you for reading!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.