本文介绍了PHP - 获取路径减根的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我有这个链接:



(我们使用别名系统。)

然后我打开一个弹出式iframe()



我怎样才能将字符串Amelia-Cove传递给该页面?



我最好的猜测是使链接= http://kenthomes.net/shareplan.php?mod=39&plan=Amelia- Cove



但是,如何从初始页面检索Amelia-Cove?

解决方案

试试这个:

$ _ SERVER ['REQUEST_URI']



在上例中,它的值为: / Amelia-Cove 。如果你想摆脱 / ,试试这个:

trim($ _SERVER ['REQUEST_URI'],'/');


So I have this link:

http://kenthomes.net/Amelia-Cove (We use an alias system.)

Then I open a pop-up iframe (http://kenthomes.net/shareplan.php?mod=39)

How I can I pass the string "Amelia-Cove" to that page?

My best guess was to make the link = to http://kenthomes.net/shareplan.php?mod=39&plan=Amelia-Cove

But how to I retrieve only "Amelia-Cove" from the initial page?

解决方案

Try this:

$_SERVER['REQUEST_URI']

In your above example, this would have a value of: /Amelia-Cove. If you want to get rid of the /, try this:

trim($_SERVER['REQUEST_URI'],'/');

这篇关于PHP - 获取路径减根的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-14 15:53