什么是code应该这背后的情况? [英] What's the code should behind this situation?

查看:191
本文介绍了什么是code应该这背后的情况?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是第二次,我在这里问一下吧。我将努力使之更容易给你答案。

这是所有关于rewriteing规则。首先,看看下面:

以下4 PHP脚本是关系到占我的PHP登录脚本的管理。

  1. account.php
  2. 的login.php
  3. signup.php
  4. logout.php

关于脚本的更多细节:

  1. Accout.php具有基于GET请求4-5页。例如。 ?页=编辑?页=视图等。

  2. login.php中只有2页,?行动=登录和?行动=块。

  3. Signup.php有3页,页=过程中,页面=过程和放大器;??步骤= 1,2

  4. logout.php只有一个​​页面。

这是我的脚本的一部分。现在,我很感兴趣地改写丑陋的URL。我希望所有的页面都有帐户preFIX。

  1. 帐户/修改
  2. 帐户/视图
  3. 帐户/登录
  4. 帐户/登录/受阻
  5. 帐户/创建
  6. 帐户/新建/步/ 1
  7. 帐户/新建/步/ 2
  8. 帐户/注销

我想我已经清除我的问题是尽我所能。我已经尝试了很多,但得到失败。我希望你们对我的答案:我怎么能这样做呢?或什么是code应该落后这种情况呢?

请,我真的非常需要你的帮助。

感谢您的支持@JonLin。多谢。但我需要你多帮助。我希望,如果你在这里帮助我可以做别人。

现在我有,

  1. forum.php FID = 1&安培; P = 2
  2. thread.php TID = 1&安培; P = 2

(它不是只有1或2,它的[(0-9)+])

如何做这样的

  1. 论坛/ F1 /什么/页2
  2. 论坛/ T1 /什么/页2

我已经试过你signup.php code一点点修改,但它不工作。

我所有的网页脚本的格式是这样,any.php XID = N&安培; P = N(!n = 1或N> 1)

所以我想用any.php同一preFIX,这涉及到any.php,IE浏览器any.php有一个book.php中我想要的网址是这样,任何/ A1 /什么/页-2和任何/ B1 /什么/页2(第-N将显示当n> 1)

请帮我在这里,我在这里停留。非常感谢您对您的友好帮助。

解决方案

  RewriteEngine叙述上

#为account.php
重写规则^账户/编辑/?$ /account.php?page=edit [L]
重写规则^帐户/视图/?$ /account.php?page=view [L]
#等等...

#到的login.php
重写规则^帐户/登录/?$ /login.php?action=login [L]
重写规则^帐户/登录/锁定/?$ /login.php?action=block [L]

#为signup.php
重写规则^帐户/创建/? /signup.php?page=process [L]
重写规则^帐户/新建/步/([12])/?$ /signup.php?page=process&step=$1 [L]

#为logout.php
重写规则^帐户/注销/?$ /logout.php [L]
 

This is the second time I'm asking here about it. I shall try to make it easier to give you the answer.

This is all about rewriteing rule. First of all, have a look below:

The following 4 php script is related to account managing of my php login script.

  1. account.php
  2. login.php
  3. signup.php
  4. logout.php

More details about the scripts:

  1. Accout.php has 4-5 pages based on GET request. E.G. ?page=edit, ?page=view etc.

  2. Login.php has only 2 pages, ?action=login and ?action=block.

  3. Signup.php has 3 pages, ?page=process, ?page=process&step=1,2.

  4. logout.php has only one page.

That's a part of my script. Now I'm interested to rewrite the ugly url. I want all the page has 'account' prefix.

  1. account/edit
  2. account/view
  3. account/login
  4. account/login/blocked
  5. account/create
  6. account/create/step/1
  7. account/create/step/2
  8. account/logout

I think I have cleared my question as much as I can. I have tried a lot but get failed. I hope you guys have the answer for me for "How could I do that?" or "What's the code should behind this situation?"

Please, I really need your help badly.

[Edit]

Thanks for your support @JonLin. Thanks a lot. But I need one more help from you. I hope if you help here i could do others.

Now i have,

  1. forum.php?fid=1&p=2
  2. thread.php?tid=1&p=2

(its not only 1 or 2, its [(0-9)+] )

How to do it like this

  1. forum/f1/anything/page-2
  2. forum/t1/anything/page-2

I've tried your signup.php code with a little edit, but its not working.

All of my pages of the script is formatted like this, any.php?xid=n&p=n ( n != 1 or n > 1 ).

So i want the same prefix used for any.php, that related to the any.php, for i.e. any.php has a book.php i want the url like this, any/a1/anything/page-2 and any/b1/anything/page-2 ( page-n will be shown when n > 1 )

Please help me here, I am stuck here. Thank you very much for your friendly help.

解决方案

RewriteEngine On

# to account.php
RewriteRule ^account/edit/?$ /account.php?page=edit [L]
RewriteRule ^account/view/?$ /account.php?page=view [L]
#etc... 

# to login.php
RewriteRule ^account/login/?$ /login.php?action=login [L]
RewriteRule ^account/login/blocked/?$ /login.php?action=block [L]

# to signup.php
RewriteRule ^account/create/? /signup.php?page=process [L]
RewriteRule ^account/create/step/([12])/?$ /signup.php?page=process&step=$1 [L]

# to logout.php
RewriteRule ^account/logout/?$ /logout.php [L]

这篇关于什么是code应该这背后的情况?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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