REQUEST_URI:echo $ url:只获取url的数量 [英] REQUEST_URI: echo$url : only get the number of url
问题描述
我有一个招聘服务网站。
当人们对空缺做出回应时,空缺的网址会在回复表单(隐藏字段)中回显,以便我看到他们回复的空缺。
我在响应按钮上使用此代码,它将重定向到响应表单:
vacature = $ url =http://。$ _ SERVER ['HTTP_HOST']。$ _ SERVER ['REQUEST_URI']; echo $ url;
在网站上,空位有标题的链接,加上空缺编号: website_url / vacancy_title-number
例如: www.test.com/director-sales-120
在响应表单中,我使用它从网址获取信息:
echo htmlspecialchars($ _GET ['vacature']);
对于我们购买的新crm系统,我们只需要数字,而不是网址的其余部分。我如何只从网址中获取数字?或者我怎么才能把这个号码加入到网址中;)
非常感谢!
$ str =www.test.com/director-sales-120;
$ arr = explode( - ,$ str);
echo $ arr [2];
I have a website for recruitment services. When people respond to a vacancy, the url of the vacancy is echo'd in the response form (hidden field) so I see on what vacancy they respond.
I use this code for it on the response button, it redirects to the response form:
vacature= $ url="http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];echo $url;
On the website the vacancies have links of the title, combined with the vacancy number: website_url/vacancy_title-number
For example: www.test.com/director-sales-120
In the response form I use this to get the info out of the url:
echo htmlspecialchars ($_GET['vacature']);
For the new crm system we bought, we need only the number, not the rest of the url. How do I get only the number out of the url? Or how do I only get the number into the url ;)
Thanks a lot in advance!
$str = "www.test.com/director-sales-120";
$arr=explode("-",$str);
echo $arr[2];
这篇关于REQUEST_URI:echo $ url:只获取url的数量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!