CodeIgniter:将参数传递到控制器时找不到页面? [英] CodeIgniter: Page not found when passing parameters to a controller?

查看:82
本文介绍了CodeIgniter:将参数传递到控制器时找不到页面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图传递参数到一个控件在codeigniter,但我得到404页面未找到错误,我没有得到它,我做了什么指南说: http://ellislab.com/codeigniter/user_guide/general/controllers.html#passinguri

I'm trying to pass parameters to a control in codeigniter, but I'm getting 404 page not found error, I don't get it, I did what the guide says: http://ellislab.com/codeigniter/user_guide/general/controllers.html#passinguri

当我删除索引函数中的参数,只是访问控制器一切工作正常,但我不能传递一个值...

When I remove the params in the index function and just access the controller everything works fine, but I can't pass a value to it...

这是我尝试发送参数的方式: http:// mysite / 123

Here is the code the way I'm trying to send a param: http://mysite/123

<?php
class Main extends Controller {

    function index($username) {

        echo $username;

    }

}
?>

如何从codeigniter获取有关此错误的更多信息?

How can I get more info regarding this error from codeigniter?

谢谢。

推荐答案

网址必须为 http:// mysite / Main / index / 123

CodeIgniter网址为 http://< url> /< Controller> ; /< Method> /< params>

CodeIgniter URLs are http://<url>/<Controller>/<Method>/<params>.

这篇关于CodeIgniter:将参数传递到控制器时找不到页面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆