获取与htaccess的网址两个变量 [英] Getting two variables in the URL with htaccess

查看:265
本文介绍了获取与htaccess的网址两个变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是要获得在URL中二送方法,通过htaccess的什么办法?

What way it is to be to get two GET methods in the URL by htaccess?

RewriteRule ^adm/(.*)$ adm.php?mode=$1

我用,对于例如网址:

I've used that for the example URL:

http://www.domain.com/adm/thismode

现在我想要得到两个方法,如:

Now I want to get two methods like:

http://www.domain.com/adm/thismode/othermode

我已经试过这样:

I've tried this:

RewriteRule ^adm/(.*)$/(.*)$ adm.php?mode=$1&othermode=$2

但似乎并没有工作...我怎么得到它这样做?

But doesn't seem to work... how do I get it to do that?

编辑:

$模式1 = $ _GET ['模式'];

$mode1 = $_GET['mode'];

$模式2 = $ _GET ['othermode'];

$mode2 = $_GET['othermode'];

就像这个...

再次编辑:

http://www.domain.com/adm/generated/pass/6z9c4q9k8p

右键......这是它必须做的网址

Right... this is the URL it has to do

和在PHP它有这样的:

And in the PHP it has this:

if($mode == "generated")

我想PHP的看到如果模式被设置在URL和生成的密码是其他的GET

I want the PHP to see if the mode is set in the URL and the generated password is the other GET

我把htaccess的是这样的:

I put the htaccess as this way:

RewriteRule ^adm/(.*)/(.*)$ adm.php?mode=$1&generated=$2

该PHP也将抢在URL生成的密码,并在页面上显示出来。

The PHP will also grab the generated password in the URL and display it on the page.

推荐答案

什么是您遇到的问题,现在看来,你需要什么样的理查德给你?

what's the problem you're having now Seems like Richard got you what you needed?

使用您的示例网址:

http://www.domain.com/adm/generated/pass/6z9c4q9k8p

在你的.htaccess以下

and the following in your .htaccess

RewriteRule ^adm/(.*)/(.*)/(.*)$ adm.php?mode=$1&generated=$2&pass=$3

那么你可以做:

then you can do:

$mode1 = $_GET['mode'];
$generated = $_GET['generated'];
$pass = $_GET['pass'];
if ( $mode1 == 'generated' && $generated == 'pass' ) 
    echo $pass;

或者是不是你的问题吗?

or was that not your question?

这篇关于获取与htaccess的网址两个变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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