如何操作此网址 [英] How can I manipulate this URL

查看:123
本文介绍了如何操作此网址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在codeproject中发布任何问题时,它将生成该问题的URL,并用-"符号代替空格.
例如,如果我发布带有此类标题的问题

When I Post any question in codeproject, it generates the URL of that question replacing the spaces with "-" sign.
For Example If I post a question with such kind of title

How Can I Rewrite URL


当我提交此问题时,它将生成与以下内容类似的URL


When I will submit this question, it will generate a URL of similar this

http://www.codeproject.com/Questions/314951/How-Can-I-Rewrite-URL



意味着它将用-"号代替标题的空白.

我该如何使用我的网址.我已使用str_replace函数将空格替换为-".并且要使用此标题,请用空格替换-".
但是问题是,可能会有一些标题本身包含-"号,那么我将如何处理呢?



Means it will replace the white spaces of the title with "-" signs.

How can I do that with my URLs. I have used str_replace function to replace the white spaces with "-". And for using this title replace back the "-" with white spaces.
But the Problem is, There may be some title that itself contains "-" sign, then how I will handle that?

Please guide me about this Problem.

推荐答案

我认为您在问的问题通常是使用称为URL编码的技术和编码格式来解决的. >.

此处对此进行了说明: http://en.wikipedia.org/wiki/URL_encoding [ http://php.net/manual/en/function.urlencode.php [ ^ ],
http://php.net/manual/en/function.urldecode.php [ ^ ].

—SA
I think you are asking about something which is normally solved using the techniques and encoding format called URL encoding.

This is explained here: http://en.wikipedia.org/wiki/URL_encoding[^].

When it comes to PHP, please see:
http://php.net/manual/en/function.urlencode.php[^],
http://php.net/manual/en/function.urldecode.php[^].

—SA


这篇关于如何操作此网址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆