生成网址别名??在 PHP 中 [英] Generate URL Alias?? in PHP

查看:21
本文介绍了生成网址别名??在 PHP 中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚在某处看到了这个,我对它很感兴趣,但似乎在任何地方都找不到,或者我只是使用了错误的词来搜索.

I just saw this somewhere, and I'm interested on it, and can't seemed to find it anywhere or I just used the wrong words to search for.

嗯,我看到了这个链接,

Well I saw this link,

http://splur.gy/r/QqVYf/r/2tgNklHgmVK

当我点击它时,我被重定向到另一个名为

and when I clicked it, I got redirected to other page which called

https://www.facebook.com/xxx.xxx?sk=app_xxxx

有人知道这个东西是怎么做的吗?或者只是一个开始的小提示?

Anyone knows how this thing was made? or just a little hint to start off?

帮助会很好.:)

推荐答案

这些都是通过 RewriteRule 完成的,一个简单的谷歌搜索就会给你更多细节.

These are done with RewriteRule, a simple Google search willgive you mroe details.

简而言之,URL 将被分解如下:(第 1 行,URL 部分,第 2 行,PHP 相关.

In short, the URL will be broken down sorta like this: (Line 1, URL part, Line 2, PHP relative.

http://splur.gy
http://splur.gy/index.php

r
$_GET['var_1']

r
$_GET['var_1']

QQVYf
$_GET['var_2']

QqVYf
$_GET['var_2']

r
$_GET['var_3']

r
$_GET['var_3']

2tgNklHgmVK
$_GET['var_4']

2tgNklHgmVK
$_GET['var_4']

RewriteMod 会将 URL 作为上述格式的设置,并将变量传递给脚本.这是在 URL 中发布变量的另一种方式.

The RewriteMod will take the URL as setup in the above format, and pass the varialbes to a script. It is another way of posting variables in the URL.

正如你在上面看到的:stackoverflow.com/posts/15182831,实际上并没有一个名为 posts/15182831 的文件,它很简单地用作一个变量,传递给一个查询该数据库的脚本,并根据脚本说了什么.

As you see above: stackoverflow.com/posts/15182831, does not actually have a file named posts/15182831, it is simple used as a variable, passed to a script which queries that database, and spits out results based on what the script says.

这篇关于生成网址别名??在 PHP 中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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