Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/codeigniter/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
文件夹中的Codeigniter Routes.php_Codeigniter_Url Rewriting_Routes - Fatal编程技术网

文件夹中的Codeigniter Routes.php

文件夹中的Codeigniter Routes.php,codeigniter,url-rewriting,routes,Codeigniter,Url Rewriting,Routes,我在Server2008上使用最新版本的CodeIgniter和IIS7.5 我的所有CI文件都位于mywebsite.com/survey文件夹中 nps = Controller survey = Function client_id = variable base64 encoded client number 我有一个在您访问时运行的脚本: 但我想让它在您访问时运行: 如何设置routes.php 我目前有: $route['/:any'] = 'nps/survey/client

我在Server2008上使用最新版本的CodeIgniter和IIS7.5

我的所有CI文件都位于mywebsite.com/survey文件夹中

nps = Controller
survey = Function
client_id = variable base64 encoded client number
我有一个在您访问时运行的脚本:

但我想让它在您访问时运行:

如何设置routes.php

我目前有:

$route['/:any'] = 'nps/survey/client_id/';
试一试

试一试

您必须确保不会在此处混淆您的路线:

只使用
$route['/:any']
是错误的(即使
(:any)
是正确的)。 要正确定义路由),请记住左侧是模式路由,右侧(在=)是转换后的
controller/method/parameter
格式

因此,定义路由(在所有其他路由之后),因为它们是从最特定到最不特定的顺序排列的(类似于允许/拒绝规则等):

您必须确保不会在此处混淆您的路线:

只使用
$route['/:any']
是错误的(即使
(:any)
是正确的)。 要正确定义路由),请记住左侧是模式路由,右侧(在=)是转换后的
controller/method/parameter
格式

因此,定义路由(在所有其他路由之后),因为它们是从最特定到最不特定的顺序排列的(类似于允许/拒绝规则等):


试试这个
$route['(:any)]='nps/survey/$1'试试这个
$route['(:any)]='nps/survey/$1'$route['(:any)'] = 'nps/survey/client_id/$1';
$route['survey/(:any)'] = 'nps/survey/client_id/$1';
$route['survey/(:any)'] = 'nps/survey/client_id/$1';