我有一个架构问题(我认为),使用CodeIgniter。
我按文件夹排列控制器,这意味着我有以下结构:
-application
--controllers
---actions
---pages
---dashboard
每次我要发一个POST,我都会在文件夹动作中保存控制器的文件,问题是提交后我的网址很乱。用户最终进入文件夹操作。一个例子是登录表单,正确的URL将是www.mysite.com/login.html但如果用户键入错误,验证器会将其发送回登录页面,但现在她是www.mysite.com/actions /login.html
在文档中说我可以将控制器保存在子文件夹中。您是否尝试过更改路线,但不知道我是否错了,但都没有工作。
有没有人经历过这个?我很好奇,我会解决这个问题。到目前为止唯一的解决方案是使用Ajax执行所有我的POSTS并且不重新加载页面:(
我的路线
$route['default_controller'] = "pages/home";
$route['sobre'] = "pages/about";
$route['como-funciona'] = "pages/how";
$route['ajuda'] = "pages/help";
$route['planos'] = "pages/plans";
$route['contato'] = "pages/contact";
$route['cadastro'] = "pages/register";
$route['login'] = "pages/login";
$route['termos'] = "pages/tos";
$route['painel'] = "dashboard/stats";
$route['404_override'] = 'errors/page_missing';
-
**EDIT**
I solved the problem adding all my actions to my route file, thus making the POST pass the new URLs
It was not what I wanted but it worked and I got time to think, thank you all.