在网站后台设计时,有时候因为项目要求,需要获取当前网页的url地址。php中获取url地址,以url中各个参数的方法有很多,那么接下来就来说一说,php中如何获取url地址,以及url中包含的其它参数的方法。
php 获取当前页面的url地址的方法
测试网址
php获取当前网页的网址,需要用到超 全局变量 $_SERVER,所以我们,先来打印一下。
php代码
<?php var_dump($_SERVER); ?>
打印结果:
array(34) { ["QUERY_STRING"]=> string(4) "id=3" ["PHP_SELF"]=> string(6) "/c.php" ["HTTP_HOST"]=> string(13) "feiniaomy.com" ["SERVER_PORT"]=> string(2) "80" ["REQUEST_METHOD"]=> string(3) "GET" ["REQUEST_URI"]=> string(11) "/c.php?id=3" ["REQUEST_SCHEME"]=> string(4) "http" ..... }
通过上面的打印结果,可以发现 $_SERVER 超全局变量是一个包含有url地址,url参数,网页的路径等肉容的数组。我们可以像平时操作数组一样,从 $_SERVER 变量中提取所需要的信息
php获取主域名
<?php echo $_SERVER['HTTP_HOST']; ?>
输出结果:
feiniaomy.com
php获取当前页面的网页地址
<?php echo $_SERVER['PHP_SELF']; ?>
输出结果:
/c.php
php获取当前页面url的参数
<?php echo $_SERVER["QUERY_STRING"]; ?>
输出结果:
id=3
php获取端口号
<?php echo $_SERVER["SERVER_PORT"]; ?>
输出结果:80
php获取当页网址的完整的url
上面的示例中,介绍了php获取url中的各个参数的方法,下面的示例是获取当前页面的完整的url地址的自定义函数。
函数代码:
<?php
function GetPageUrl(){
// 判断是否 https
$protocol = ((!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') || $_SERVER['SERVER_PORT'] == 443) ? "https://": "http://";
//组合url
$url = $protocol . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
return $url;
}
?>
函数调用方法:
<?php echo GetPageUrl(); ?>
输出结果:
Interaction Of Vitamin D And Amoxicillin
generic cialis uk Generic Cialis
Singh H, et al
The dual inhibition of both BRAF and MEK leads to more significant tumor response than BRAF therapy alone 26 In addition, experiments were conducted according to Guidelines for the Welfare of Animals in Experimental Neoplasia published by The United Kingdom Coordinating Committee on Cancer Research
Albuterol; phenylephrine; tetracycline notice a doctor if you need to have been given to continue
It is estimated that half of the patients with cancer will receive radiation therapy, with skin injuries due to radiation therapy occurring in approximately 95
Similar to the results of tamoxifen studies, TOR usually reduces TC and LDL C levels while increases TG and HDL C cholesterol 36, 37
4A and oxidative phosphorylation were observed Fig
Conversely, the opposition said the army is implementing the will of the people
diarex decadron online A month of combat in the U
5 There are no known antidotes for dutasteride To improve their appearance, men seek out various treatments that claim to eliminate male breasts
Bergstrom DA, Penn BH, Strand A, Perry RL, Rudnicki MA, Tapscott SJ Promoter specific regulation of MyoD binding and signal transduction cooperate to pattern gene expression
Always speak with your doctor or pharmacist about dosages that are right for you knockout, knockin and transgenic mouse models will permit the study of genes and their mutations in health and pathology
Avoid driving or hazardous activity until you know how this medicine will affect you Therefore, hand antisepsis after glove removal is mandatory
on 17 July 2013 to learn how you can embrace business technology trends to deliver next generation business process solutions
Berlin based Zalando said OTPP took the stake as part of a4 percent capital increase at the group For patients treated with surgery alone the PFS was 84 and 62 at 5 and 10 years, respectively
In most cases, all 3 of those etiologic factors contribute to hyperkalemia and Foroozan, P
Zhang R, et al
Femara users with hand pain It would seem unnecessary to introduce any further avenues of investigation into neuroprotective strategies
constellatus in 3 While the BLA and EC connections are important for recalling remote memories, the CLA projection is specifically important for recalling recent ones
Targeting lipid rafts inhibits protein kinase B by disrupting calcium homeostasis and attenuates malignant properties of melanoma cells Whereas the procedure of classifying donations also entailed a process of getting familiar with their chemical compound and properties, the volunteers tended to personify the medications donated as also briefly mentioned in the opening vignette of the present article
For instance, abnormal sperm production or function, problems with the delivery of the sperm, overexposure to certain environmental factors or damage to the male sex organs due to cancer or its treatment
You can t control that
The cells were serially expanded, and passages 3 6 were used for experiments The long term efficacy and safety of respiratory stimulants remain uncertain
As a cosmetic professional I just recommend to anyone else to completely stop using the brand if you re getting side effects
With the number of new US cancer cases set to rise by roughly a third over the next decade, continued investment in research at the national level is crucial to continuing critical progress in the prevention, screening, diagnosis, and treatment of cancer So the doctor chose to start me right on 100mg clomid on CD 14
Second, the use of other cardiovascular risk modifying medications was well balanced between the FDC and multipill groups, both at baseline and in the last 90 days of follow up
Although patients may not experience symptoms during the initial stages of cancer, understanding the C
00 reference 218 1
Howdy are using WordPress for your blog platform? I’m new
to the blog world but I’m trying to get started and set up my own. Do you need any coding knowledge to make your
own blog? Any help would be greatly appreciated!
Thanks for sharing your thoughts on essay help. Regards
Ahaa, its nice conversation regarding this piece of writing at this place at this weblog, I
have read all that, so at this time mee also commenting here.
Here is my homepage …
you are in point of fact a just right webmaster.
The website loading pace is amazing. It kind of feels that
you are doing any unique trick. Furthermore, The contents are masterpiece.
you’ve performed a great activity in this topic!
First off I want to say great blog! I had a quick question in which I’d like to ask if you don’t mind.
I was curious to find out how you center yourself
and clear your head prior to writing. I have had
a hard time clearing my thoughts in getting my thoughts out.
I do enjoy writing however it just seems like the first 10 to 15 minutes are usually wasted just trying
to figure out how to begin. Any ideas or hints? Thank you!
Definitely believe that which you stated. Your favorite
reason seemed to be on the net the easiest thing
to be aware of. I say to you, I certainly get irked while people
consider worries that they just don’t know about. You managed to hit the nail upon the
top as well as defined out the whole thing without having side effect , people could take
a signal. Will likely be back to get more. Thanks
Wow! This blog looks just like my old one! It’s on a totally
different subject but it has pretty much the same
layout and design. Wonderful choice of colors!
In case you have a alternative between having a master’s and not having a master’s, it is healthier to have the
master’s for two reasons: First, the credential it brings will generally open some
doorways. Matte plastics with a dry, papery feel don’t quite produce the
dramatic, sultry look of glossier phones, but we favored the how safe they made the cellphone really feel in our arms, and the practicality of not having to wipe
away fingerprints on a regular basis. Not only does the slider feel great
to play with, it makes it a lot simpler to navigate between the completely different methods.
Did he play a task within the 1979 takeover
of the U.S. For her half, Carey, alongside Jackson, seems to be relishing the function of seasoned business participant,
while Urban is described by the producers as the voice of “sanity”
on the panel. As a part of its full-on pitch to
music fans, Nokia has equipped the XpressMusic a personal media
participant, FM radio, and even a succesful constructed-in speaker.
We liked the highly sensible form-issue, feel and emphasis on an easy-to-access media participant, but additionally felt it
wanted some extra tweaking on the software program side.
Whereas the pledge of US$20 billion from the G8 for agriculture in July 2009 is important, and the new emphasis on self-sufficiency,
in addition to meals security, is welcome, it is vital to ensure that this US$20 billion is new and never recycled contributions, and to
acknowledge that it’ll only fund an estimated three years (at
US$7 billion per year) of the activities that will likely be required
for protecting agriculture from climate change.
This information is priceless. Where can I find out more?
Hi there, I log on to your new stuff on a regular basis. Your humoristic style is witty, keep doing what
you’re doing!
Канал о бизнесе, стартапах, новых
тенденциях и возможностях в России.
Немного мотивации и психологии.
#стартап Ждём:
Yesterday, while I was at work, my sister stole my
apple ipad and tested to see if it can survive a twenty
five foot drop, just so she can be a youtube sensation. My iPad is now broken and she has 83 views.
I know this is completely off topic but I had to share
it with someone!
Wow that was odd. I just wrote an incredibly long comment but
after I clicked submit my comment didn’t appear. Grrrr…
well I’m not writing all that over again. Regardless, just wanted to
say wonderful blog!
Everything is very open with a precise clarification of the challenges.
It was really informative. Your website is extremely helpful.
Thanks for sharing!
Wow, incredible blog layout! How long have you been blogging for?
you make blogging look easy. The overall look of your web site is great, let alone the content!
If you desire to increase your familiarity simply keep visiting this website and be updated with the hottest news posted here.
I am curious to find out what blog system
you happen to be utilizing? I’m having some minor security issues with my latest website
and I’d like to find something more risk-free.
Do you have any suggestions?
Hello very cool web site!! Guy .. Excellent ..
Superb .. I will bookmark your site and take the feeds additionally?
I am happy to seek out numerous helpful information here in the put up, we need develop extra strategies on this regard,
thanks for sharing. . . . . .
Link exchange is nothing else however it is just placing the other person’s website
link on your page at proper place and other person will also do same in support of
you.
Thanks in support of sharing such a pleasant thought, article
is nice, thats why i have read it entirely
naturally like your website but you have to take a look
at the spelling on several of your posts. Many of them
are rife with spelling problems and I in finding it very troublesome to tell
the reality then again I’ll certainly come again again.
When I originally commented I clicked the “Notify me when new comments are added” checkbox and now ewch time
a comment is added I get four emails with the same comment.
Is theree any waay you can remove people ffrom that service?
Bless you!
Also visit my blog post …
An impressive share! I have just forwarded this onto a friend who had been conducting
a little research on this. And he in fact bought
me breakfast because I stumbled upon it for him… lol.
So allow me to reword this…. Thank YOU for the meal!!
But yeah, thanx for spending the time to discuss this issue here on your internet
site.
Woah! I’m really digging the template/theme of this website.
It’s simple, yet effective. A lot of times it’s difficult to get that “perfect balance” between usability and
visual appeal. I must say you’ve done a very good job
with this. Additionally, the blog loads extremely quick for me on Firefox.
Outstanding Blog!
Excellent post. I was checking constantly this blog and I am impressed!
Extremely helpful info specifically the ultimate section 🙂 I deal
with such info a lot. I used to be looking for this particular info for a very long time.
Thank you and good luck.
Hі there! This is kind of off topic but I need some һelp from an established blog.
Is it difficult to set up your own blog? I’m not very techincal but
I cаn figurе things out pretty quick. I’mthinking
about setting up my own but I’m not sure where to start.
Do you have any points or ѕuɡgestions? Thank you
Great article! That is the kind of information that are supposed to be shared around the web.
Shame on Google for now not positioning this submit upper! Come
on over and visit my site . Thanks =)
The top 10 sugar daddy websites & apps help hundreds of thousands of generous sugar daddies and enticing sugar infants in Canada for mutually helpful relationships.
These websites typically use Ajax, Web 2.Zero applied sciences, and
different advanced options to offer a extra
user-pleasant expertise. You need to use our API for eCommerce,
request completion, order processing, and monetary and reporting administration. Various trade analysts have observed that the dimensions of the marketplace for API management options has been rising rapidly since the early 2010s.
Gartner estimated the scale of the marketplace for API management to be $70 million in 2013 and to be growing at 40% a yr.
Each participant tries to create the most
important variety of related tags for a sequence of images.
This not only saves time and sources but in addition opens up the opportunity of producing a
much bigger number of recipes. Critics recommend that the task of making
and maintaining such complex recordsdata is an excessive
amount of work for most individuals.
Wow that was strange. I just wrote an incredibly long comment but after I clicked submit my comment didn’t show up.
Grrrr… well I’m not writing all that over again. Anyways, just wanted to say great
blog!
This info is worth everyone’s attention. Where can I find out more?
I blog often and I really appreciate your information.
The article has really peaked my interest. I am going to
bookmark your blog and keep checking for new
information about once a week. I opted in for your RSS
feed too.
Heya i am for the first time here. I came across this board and I to find It really
helpful & it helped me out a lot. I am hoping to
offer something again and aid others like you helped me.
ANA has finally put in particular person air nozzles on their new 777s.
YAY! And it’s not simply that they did that,
but additionally they improved on the other issues I’ve had with ANA up to now – they put in particular person air nozzles, and so they introduced
fast and reasonably priced Wi-Fi with no information caps.
The in-flight entertainment was stable, and the Wi-Fi did precisely what I
wanted it to do: assist me stay related to buddies and household
on the ground. Hopefully the picture below offers you a way
of how low the seat is off the bottom. Using digital credit
score gives you more freedom to experiment with different guess types and sizes.
For example, /distant.php/dav/ utilizing a delimiter of .php would strive the file
/distant.php. For instance, /foo/bar matches
both /foo/bar and /foo%2Fbar, however /foo%2Fbar will match solely /foo%2Fbar, because the escape sequence is explicitly given within the configuration. For example, when you have each a
header and path matcher within the set, each must match.
By request header fields. By request path (the trail component of
the request URI). Path matching is a precise match by default, not a
prefix match. Match requests with paths that don’t begin with /css/ OR /js/.
Hi there would you mind letting me know which webhost you’re working with?
I’ve loaded your blog in 3 completely different browsers and I must say this blog loads a lot quicker then most.
Can you suggest a good internet hosting provider at a reasonable
price? Many thanks, I appreciate it!
If some one nesds to be updated with newest technologies tthen he
must be pay a quick visit thjs web page and be up to date every day.
my sjte
QH
Someone necessarily help to make seriously articles I’d state.
This is the first time I frequented your website page and up to now?
I amazed with the analysis you made to make this particular submit incredible.
Fantastic job!
I know this if off topic but I’m looking into starting my own weblog and was
wondering what all is required to get set up?
I’m assuming having a blog like yours would cost a pretty penny?
I’m not very internet smart so I’m not 100% sure.
Any recommendations or advice would be greatly appreciated.
Appreciate it
Its like you read my mind! You seem to know a lot about this, like
you wrote the book in it or something. I think that you could do with
a few pics to drive the message home a little bit, but other than that, this is excellent
blog. An excellent read. I will definitely be back.
Here is my site …
I’ve been surfing online more than three hours
today, yet I never found any interesting article like yours.
It is lovely value enough for me. Personally, if all site owners and bloggers made good content material as you probably did, the
net can be much more useful than ever before.
Thanks in support of sharing such a pleasant thinking,
piece of writing is fastidious, thats why i have read it fully
This blog was… how do you say it? Relevant!!
Finally I’ve found something that helped me. Thanks a lot!
For latest news you have to pay a visit the web and on the web I found this site
as a finest website for newest updates.
It’s actually a nice and useful piece of information. I am glad that you simply shared this useful information with us.
Please keep us up to date like this. Thanks for sharing.
Definitely believe that that you said. Your favourite justification appeared to be at the net the easiest
thing to keep in mind of. I say to you, I definitely get irked while folks consider issues
that they plainly do not know about. You managed to hit the nail upon the highest and defined out the whole thing without
having side effect , other folks could take a signal.
Will likely be back to get more. Thanks
All sort of software program are designed by eagle technosys.
Eagle Technosys software program Development Company which is accountable
for all type of software program which actually meets the desire requirement of the
purchasers or prospects. Your app needs to have lots
of distinctive features that may sophisticate the purchasers as well as the owners.
Launching your personal Uber-like app will make it easier to reach all of your
potential customers. The ChatGPT Clone Script is sort of a ready-made Ai Powered software solution that may help
you in launching your AI chatbot like ChatGPT, simply.
Software piracy is theft, Using crack, password, serial numbers, registration codes, key
generators, cd key, hacks is illegal and stop future development of Retail Me Not Clone Alternative Script v.1.Zero Edition. Today it is far
easier to create a YouTube like web page with a free video
sharing web site software and you can easily get
one from the a number of on-line repositories.
In case you see something like 7/2, this means in case you bet £2, you will win £7 and obtain your preliminary bet
of £2 – the overall payout will quantity to £9. On the Daily Free
Football Predictions you will note right this moment match prediction/as we speak prediction. Players staying
in a bad form often see their overall degree of play affected:
a component to be taken into account nearly
as a lot as the quality of the players. However, in this article,
we’ll talk about each step in much better detail.
Note. Once you shift from the Creator Fund to Creativity Program Beta,
you is not going to be capable of revert again to the Creator Fund.
Reward Payments underneath the Creativity Program Beta will be freed from cost.
For the avoidance of doubt, not all content material you submit
to participate in the Creativity Program Beta will accumulate Rewards.
Participation in Creativity Program Beta doesn’t require payment.
What can I get if I shift to Creativity Program Beta? Because of this they must either win or they can lose by not
more than six factors. Football Tips Predictions
are a should for anybody who intends to place a bet on the outcome of a sport
in the hopes of making some money.
Thanks for finally talking about > PHP中获取当前页面的URL地址的方法 < Loved it!
I visited various blogs however the audio feature for audio songs current at
this web site is genuinely superb.
Greetings from California! I’m bored at work so I decided to browse your
website on my iphone during lunch break. I enjoy the
knowledge you present here and can’t wait to take a look when I get home.
I’m shocked at how fast your blog loaded on my phone ..
I’m not even using WIFI, just 3G .. Anyhow, great site!
Heya i am for the first time here. I came across this board
and I find It truly useful & it helped me out a lot.
I’m hoping to provide something back and aid others such as you
helped me.
I blog frequently and I genuinely thank you for your content.
Your article has really peaked my interest. I’m going to
take a note of your blog and keep checking for
new information about once per week. I subscribed to
your RSS feed as well.
Hi! Would you mind if I share your blog with my zynga group?
There’s a lot of folks that I think would really appreciate
your content. Please let me know. Cheers
I don’t even know how I ended up here, but I thought this post
was good. I do not know who you are but definitely you’re going
to a famous blogger if you are not already 😉 Cheers!
Also visit my page …
I always emailed this webpage post page to all my friends, as if like to read it after that
my contacts will too.
Hoy descubrí la increíble relación entre mis riñones y mi sistema
cardiovascular. No tenía idea de que estos
órganos trabajaran juntos para mantener mi cuerpo en equilibrio.
¡Es fascinante cómo cada parte de nuestro cuerpo está interconectada!
Hmm is anyone else experiencing problems with the pictures
on this blog loading? I’m trying to find out if its a problem on my end or if it’s
the blog. Any feedback would be greatly appreciated.
I just like the valuable information you provide for
your articles. I’ll bookmark your weblog and test once more right here
regularly. I am fairly sure I’ll be informed many new stuff proper right here!
Best of luck for the next!
Hey! I could have sworn I’ve been to this
site before but after checking through some of the post I realized it’s new to me.
Nonetheless, I’m definitely glad I found it and I’ll be
bookmarking and checking back often!
Hi there, this weekend is fastidious for me, since this moment i am reading this great informative paragraph here at my house.
Look into my blog post:
On this information, I wish to introduce Linux users
to gaming, what tools are available, and methods to set it up.
Benefits administration companies are also accessible,
but pricing varies depending on the insurance broker.
There are plenty of SMS APIs and SMS gateways obtainable,
so start by researching the present market. Bulk SMS is a fast and
trustworthy technique for promoting the products and companies offered by your model.
Tree SMS is a number one and rising identify in terms of providing Bulk SMS in Delhi
NCR. Instead of counting on only a few firms for the incredibly important job
of organizing online data, users also can collaborate and organize search and discovery collectively, offering extra control over indexing
and rating, as well as higher privateness safety.
SkyPrep is a Canadian firm that has been within the enterprise of offering high-class elearning instruments for nearly
a decade. Their cloud-based mostly LMS software of the same name
leverages modern know-how to ship solutions that simplify studying
and drive enterprise productiveness.
Hi friends, its great post on the topic of tutoringand completely explained, keep it up all the time.
What’s up, yup this paragraph is in fact pleasant and I have learned lot of things from it
about blogging. thanks.
Spot on with this write-up, I really think this web site needs much
more attention. I’ll probably be returning to read more, thanks for
the information!
My spouse and I stumbled over here by a different website and thought I should check
things out. I like what I see so i am just following you.
Look forward to exploring your web page again.
I really like your blog.. very nice colors & theme. Did you make this website yourself or did you hire
someone to do it for you? Plz answer back as I’m looking to construct my own blog and would like to know
where u got this from. appreciate it
I’m not sure why but this web site is loading incredibly slow for me.
Is anyone else having this problem or is it a problem on my end?
I’ll check back later on and see if the problem still exists.
It’s appropriate time to make a few plans
for the longer term and it is time to be happy. I’ve learn this publish and if I could I desire to recommend you few interesting issues or advice.
Perhaps you can write subsequent articles regarding this article.
I want to learn more things about it!
Informative article, exactly what I wanted to find.
Hey there are using WordPress for your site platform?
I’m new to the blog world but I’m trying to get started and create my own. Do
you need any coding knowledge to make your own blog? Any help
would be greatly appreciated!
We are a group of volunteers and opening a brand new scheme in our community.
Your web site offered us with useful information to work on. You’ve
performed an impressive job and our whole neighborhood will probably be grateful to you.