文件夹中的Codeigniter Routes.php
我在Server2008上使用最新版本的CodeIgniter和IIS7.5 我的所有CI文件都位于mywebsite.com/survey文件夹中文件夹中的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
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';