Php CI如何在使用控制器或转到真实文件夹之间进行利用?
CI如何在使用控制器或转到真实文件夹之间进行利用 如果我有一个URL:Php CI如何在使用控制器或转到真实文件夹之间进行利用?,php,codeigniter,Php,Codeigniter,CI如何在使用控制器或转到真实文件夹之间进行利用 如果我有一个URL:http://localhost/sencha/touch/ 我有一个同名的控制器方法和文件夹(但其中没有索引文件)。我的Apache服务器将为我提供文件夹的目录列表,而不是控制器方法(这将为我提供正确的索引文件) 更多上下文: 我有一个codeIgniter应用程序和一个sencha Touch应用程序,一个ExtJS应用程序,还有一些午睡测试 文件夹结构如下所示: -application -config -c
http://localhost/sencha/touch/
我有一个同名的控制器方法和文件夹(但其中没有索引文件)。我的Apache服务器将为我提供文件夹的目录列表,而不是控制器方法(这将为我提供正确的索引文件)
更多上下文:
我有一个codeIgniter应用程序和一个sencha Touch应用程序,一个ExtJS应用程序,还有一些午睡测试
文件夹结构如下所示:
-application
-config
-controller
-sencha.php
methods:
touch()
touch-siesta()
ext()
ext-siesta()
-some_other_controllers...
-model
-view
-template
-some_other_views....
-... other CI folders ...
-css
-js
-sencha
-touch
app -> with the sencha mvc structure
-touch-siesta -> with the siesta stuff
-ext
app -> with the sencha mvc structure
-ext-siesta -> with the siesta stuff
-system
-index.php
下面的url都为我提供了目录列表,而不是使用控制器方法
http://localhost/sencha/touch/
http://localhost/sencha/touch-siesta/
http://localhost/sencha/ext/
http://localhost/sencha/ext-siesta/
更新:
我在重写条件下有以下行:
RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?/$1 [L]
我注释掉了检查它是否为有效目录的行。
.htaccess
规则将在服务器发出其他请求之前首先处理,AFAIK CI尚未处理该问题,因此,您可以执行以下任一操作:
-application
-config
-controller
-sencha.php
methods:
touch()
touch-siesta()
ext()
ext-siesta()
-some_other_controllers...
-model
-view
-template
-some_other_views....
-... other CI folders ...
-css
-js
-sencha
-touch
app -> with the sencha mvc structure
-touch-siesta -> with the siesta stuff
-ext
app -> with the sencha mvc structure
-ext-siesta -> with the siesta stuff
-system
-index.php
Mod\u rewrite
Mod_rewrite
规则,例如:
RewriteRule /touch/(.*)$ /index.php/touch/$1
但这只是针对特定要求的工作,效率不高第一个选项不是一个选项。第三个当然是目标。但我会尝试第二种,效率不高,但如果它有效的话。。。它只适用于4个文件夹。。。我会接受的,在我测试之后;)塔克斯!