简体   繁体   English

Codeigniter 控制器类登录表单:找不到 404 页面

[英]Codeigniter Controller class login form : 404 page not found

Im trying to combine several tutorials about Codeigniter and bootstrap and understand per codes so i can integrate it in my project.我试图结合几个关于 Codeigniter 和 bootstrap 的教程并理解每个代码,以便我可以将它集成到我的项目中。 What i am trying to do right now is create a login form using the two framework.我现在想做的是使用这两个框架创建一个登录表单。

And i setup my View according to the turotial included in Codeigniter 'user_guide/tutorial/static_pages.html' which my landing page is named as 'home.php' is inside the folder 'pages' and header.php, and footer.php is inside the 'templates' folder.我根据 Codeigniter 'user_guide/tutorial/static_pages.html' 中包含的 turotial 设置我的视图,我的登陆页面被命名为 'home.php' 位于文件夹 'pages' 和 header.php 中,footer.php 是在“模板”文件夹内。 I created also a controller: Page.php.我还创建了一个控制器:Page.php。

I also use .htaccess to hide 'index.php'.我还使用 .htaccess 来隐藏“index.php”。 Now i follow this tutorial how to create a login page: http://learnjquerybootstrap.blogspot.com/2015/01/login-session-using-codeigniter-and-bootstrap.html?m=1现在我按照本教程如何创建登录页面: http : //learnjquerybootstrap.blogspot.com/2015/01/login-session-using-codeigniter-and-bootstrap.html ?m=1

-the only difference is this since i use htaccess: -唯一的区别是因为我使用 htaccess:

<?php echo form_open(clogin/index); ?>

But when I try to submit the page i receive a: 404 page not found.但是当我尝试提交页面时,我收到一个:404 页面未找到。 My navbar links are working fine.我的导航栏链接工作正常。 I understand that the codeigniter works like this:我知道 codeigniter 是这样工作的:

http://localhost/myfolder/index.php/class/function/ http://localhost/myfolder/index.php/class/function/

so when i submit my form the url that show up is:所以当我提交表单时,显示的 url 是:

http://localhost/myfolder/clogin/index http://localhost/myfolder/clogin/index

and gives me: 404 page not found.并给我:找不到 404 页面。

Question: What is wrong with it?问题:它有什么问题? is there something wrong with the tutorial that i am using?我正在使用的教程有问题吗? i check other tutorials and the controller structure is just the same, like on this link:我检查了其他教程,控制器结构是一样的,就像这个链接:

http://www.kodingmadesimple.com/2014/08/how-to-create-login-form-codeigniter-mysql-twitter-bootstrap.html http://www.kodingmadesimple.com/2014/08/how-to-create-login-form-codeigniter-mysql-twitter-bootstrap.html

do i need to include clogin.php in route.php?我需要在route.php 中包含clogin.php 吗? or is it about the htaccess?还是关于htaccess? my我的

uri_protocol

is configured as被配置为

'REQUEST_URI' 

in config.php.在 config.php 中。 i tried other options but still the same.我尝试了其他选择,但还是一样。

Don't need include to route.不需要包含路由。 I recommented ready auth library.我推荐了现成的身份验证库。 If you use DevTools in your browser maybe "Network" tab of devtools can help you to why you get 404 error.如果您在浏览器中使用 DevTools,也许 devtools 的“网络”选项卡可以帮助您了解为什么会出现 404 错误。

i already firgured it out.The mistake was in the route.php, since i tried to combine two examples.. i realized that the wildcard route that i included from the Codeigniter user guide will not work with the Clogin.php.我已经把它弄出来了。错误出在 route.php 中,因为我试图结合两个例子。我意识到我从 Codeigniter 用户指南中包含的通配符路由不适用于 Clogin.php。

Since it was set as由于它被设置为

$route['(:any)']='pages/view/$1';

So the url works as所以网址的作用是

http://localhost/myfolder/pages/view/clogin

instead of代替

http://localhost/myfolder/clogin . http://localhost/myfolder/clogin

I removed it and now it is working.我删除了它,现在它正在工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM