从网址获取号码的最简单方法是什么?
我希望有人可以帮助我,我已经创建了这样的网址
/this/is/a/test/index.asp
/this/is/a/test/index-1.asp
/this/is/a/test/index-2.asp
/this/is/a/test/index-3.asp
从网址中删除数字的最简单方法是什么?
我没有使用这样的变量:
/this/is/a/test/index.asp?no=1
/this/is/a/test/index.asp?no=2
/this/is/a/test/index.asp?no=3
为了创建变量,我使用 URL 中的数字来动态调用页面上的内容。
如果网址是: /this/is/a/test/index-3.asp
它应该使用 3 并根据它匹配内容,类似于我要调用
?没有=3
我为此使用 PHP...
url 结构将始终将变量定义为与最后一个 '-' [the-number] '.asp' 匹配,
谢谢
Gerald Ferreira
I am hoping someone can help me, I have created url's like this
/this/is/a/test/index.asp
/this/is/a/test/index-1.asp
/this/is/a/test/index-2.asp
/this/is/a/test/index-3.asp
What is the easiest way to strip the number from the URL?
Instead of using variables like this:
/this/is/a/test/index.asp?no=1
/this/is/a/test/index.asp?no=2
/this/is/a/test/index.asp?no=3
to create variables I am using the number in the URL to dynamically call the content on the page.
If the url is: /this/is/a/test/index-3.asp
it should use the 3 and match the content according to it, similar as if I were to call
?no=3
I am using PHP for this...
The url structure will always have the variable define as match the last '-' [the-number] '.asp'
Thanks
Gerald Ferreira
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用 mod_rewrite 将 URL 模式映射到实际 URL。您可以通过类似于以下内容来实现您想要的:
You could use mod_rewrite to map URL patterns to actual URLs. You could achieve what you want with something similar to the following:
您应该能够将其与:
You should be able to match it out with: