Php can';t调用控制器codeigniter中的第二个函数

Php can';t调用控制器codeigniter中的第二个函数,php,.htaccess,codeigniter,controller,clean-urls,Php,.htaccess,Codeigniter,Controller,Clean Urls,我是新来的codeigniter我有问题 我使用我的OS X Lion,我使用.htaccess我可以直接调用localhost/site\u文件夹/它的工作原理与charm类似,但我的控制器中有第二个函数,但我不能像这个localhost/site\u文件夹/function2那样直接调用该函数 这是我的控制器 class My_site extends CI_Controller { function __construct() { parent::__construct(); }

我是新来的codeigniter我有问题

我使用我的OS X Lion,我使用
.htaccess
我可以直接调用localhost/site\u文件夹/它的工作原理与charm类似,但我的控制器中有第二个函数,但我不能像这个localhost/site\u文件夹/function2那样直接调用该函数

这是我的控制器

class My_site extends CI_Controller {
function __construct() {
  parent::__construct();
  }
function index() {
  --some script--
  }
function function2() {
  --some script--
  }
}
而且上面说找不到url,为什么


谢谢

默认路由方案是
example.com/class/function/id/

如果
site\u folder
是您安装codeigniter的文件夹,则您指向
function2
的url为

http://localhost/site_folder/my_site/function2

我在这个论坛上找到了解决方案

根据codeigniter自动将index.php添加到config.php文件(第38行)中指定的“localhost/site_folder/”中。因此,要调用该函数,您必须转到“localhost/site\u folder/index.php/function2”

您能把路由代码放在这里吗?(
config/routes.php
)如果我的站点不是您的默认控制器,我想您需要通过
http://localhost/site_folder/my_site/function2
@safarov这是我的
config/routes$route['default\u controller']=“myshop”
@Shiplu我已经像你说的那样尝试了,但没有结果..我仍然无法访问。。这里是我的.htaccess
RewriteCond%{REQUEST_FILENAME}上的RewriteEngine-f RewriteCond%{REQUEST_FILENAME}-d重写秒1美元^(index\.php | images | robots\.txt | css)RewriteRule^(.*)$index.php/$1[L]
是否正确?
  It may be the issue please Check the uri protocol in the config file that should be AUTO.

  Config/config.php ===> $config['uri_protocol']    = 'AUTO';