首页 \ 问答 \ Mod重写Ft子目录和目录的Htaccess(Mod Rewrite Htaccess for Fake sub Directories and directory)

Mod重写Ft子目录和目录的Htaccess(Mod Rewrite Htaccess for Fake sub Directories and directory)

我正在尝试创建虚假目录以将特定参数重定向到特定子目录:来自:www.example.com/sys/signup要访问:www.example.com/system/ext.php?t = signup


I am trying to create fake directories to redirect specific parameters to specific subdirectories as such: From: www.example.com/sys/signup To: www.example.com/system/ext.php?t=signup


原文:https://stackoverflow.com/questions/27258104
更新时间:2022-04-06 13:04

最满意答案

为了回答我自己的问题,Engine.main()中的循环就像它应该的那样工作,但是我从while语句中取出了self.room.describe():

def main(self):
    self.room.describe() #Describes the current room.
    while True:
        # Ask for user prompt
        input = raw_input(self.room.prompt)
        cmd = input.lower()
        ...etc, etc, etc...

然后我将GoCommand更改为:

class GoCommand(Command):
def __init__(self, direction):
    self.direction = direction

def execute(self):
    # 'E' is the instantiation of the Engine class, declared within engine.py
    from engine import E

    # self.direction is 'north' in our example
    if self.direction in E.room.map.keys():
        print "You head %s\n" % self.direction # Pretty explanatory

        E.room = E.room.map[self.direction]
        print E.room.describe()
    else:
        print "You can't go that way."

一切都按照应有的方式运作。


To answer my own question, the loop in Engine.main() works just as its supposed to, but I took self.room.describe() out of the while statement:

def main(self):
    self.room.describe() #Describes the current room.
    while True:
        # Ask for user prompt
        input = raw_input(self.room.prompt)
        cmd = input.lower()
        ...etc, etc, etc...

Then I changed the GoCommand to:

class GoCommand(Command):
def __init__(self, direction):
    self.direction = direction

def execute(self):
    # 'E' is the instantiation of the Engine class, declared within engine.py
    from engine import E

    # self.direction is 'north' in our example
    if self.direction in E.room.map.keys():
        print "You head %s\n" % self.direction # Pretty explanatory

        E.room = E.room.map[self.direction]
        print E.room.describe()
    else:
        print "You can't go that way."

And everything works as its supposed to.

相关问答

更多
  • 您不能将字符串与整数连接,而是可以使用format print('The enemy\'s health is at {}! Keep attacking Guardian!'.format(enemy_health)) 要使用+运算符并执行连接,首先必须先创建一个字符串 print('The enemy\'s health is at ' + str(enemy_health) + '! Keep attacking Guardian!' 你还需要实际修改他们的健康状况,我不确定你认为这是做什么的 e ...
  • 你似乎有一些定义状态的东西:self .__ player_health,self .__ player_name,self .__ health_potion,self .__ big_wrench,self .__ blue_keycard。 我需要仔细阅读,但找不到定义进展的状态。 使用定义状态的所有内容,您可以保存并从文本文件中读取 - 如果您的目标是简单性。 一种方法是使用dict结构来存储文本,等待时间和功能(如果可用,如战斗),如页面。 然后使用数组来存储这些页面,这将是你的书。 如果你有一个 ...
  • 为了回答我自己的问题,Engine.main()中的循环就像它应该的那样工作,但是我从while语句中取出了self.room.describe(): def main(self): self.room.describe() #Describes the current room. while True: # Ask for user prompt input = raw_input(self.room.prompt) cmd = input. ...
  • 我认为发生“失败”是因为每次char_loc不在51和55之间时都会发生。 if (char_loc >= 11 and char_loc <= 15): if (char_loc >= 21 and char_loc <= 25): if (char_loc >= 31 and char_loc <= 35): if (char_loc >= 41 and char_loc <= 45): if (char_loc >= 51 and char_loc <= 55): else: 我认为你想在这里做的是 ...
  • 首先,如果你正在使用python2.7,你需要知道input(),如果你通过控制台给它一个数字,这个函数转换为int,那么你需要检查值,如果choice == 1或只是将输入更改为raw_input() (这是最好的方法), if choice!='1' and choice!='2':需要放入else:那么可以避免大量检查或意外值。 如果你使用python3,raw_input是新的输入函数,所以你不需要改变它 最后,如果你想使用raw_input()或者你正在使用python3,你需要将随机函数改为ra ...
  • Pickle本身有其他的协议,比默认协议(协议0)更紧凑 - 这是唯一的“基于文本” - 其他协议是二进制协议。 但是,他们几乎不会超过文件大小的50% - 能够增强答案,我们需要更好地了解您正在保存的内容,以及是否有更聪明的方式来保存数据 - 例如,通过避免如果它存在于您的几个房间中,则重复相同的子数据结构。 (尽管如果你在游戏中使用对象身份,Pickle应该照顾到这一点)。 也就是说,只需将pickle.dump调用更改为包含协议参数 - -1值相当于“HIGHEST_PROTOCOL”,通常这是最高效 ...
  • 这是一个相当开放的问题(不必下载任何“插件”)? 但你想要的是curses库,Python与curses模块有一个接口。 Python文档提供了一个使用它的简单教程 。 还有一个名为Blessings的库,它为curses提供了一个更好,更现代的面向对象的接口。 我没有尝试过,但它得到了很好的支持,看起来还不错。 This is a rather open-ended question (not have to download any "plugins")? But what you want is th ...
  • 我没有看到相关的代码实际上在屏幕上显示蛇的当前位置,并在移动后将其移除,但如果您将蛇的长度变为变量并将其绘制并移除,则可以在这里更改大小一种迭代的方式。 当食物被吃掉时,你可以简单地增加蛇长度变量的大小,并且随着蛇的移动沿着其向量进行,直到期望的增长发生时暂停清除蛇的移动,此时可以以新的长度进行移动。 请澄清实际呈现蛇位置的代码部分。 I do not see the associated code that actually displays the current position of the sna ...
  • 你有两个while True循环 - 一个接一个。 第一 done = False while not done: for event in pygame.event.get(): if event.type == pygame.QUIT: done = True elif event.type == pygame.MOUSEBUTTONDOWN: click_sound.play() 正在运行,直到你点击“X”按钮 ...
  • 这是你追求的结构吗? choices = { 1 : { 'prompt' : { 'prompt' : 'Level 1 prompt', 'A' : 'Choice A', 'B' : 'Choice B', 'C' : 'Choice C' }, }, 2 : { 'promptA' : { 'prompt' : 'Level 2 prompt A', ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)