Php 控制器中的函数不工作
我有一个具有索引功能的控制器,现在我正试图为codeignitor控制器中的滚动分页做更多的基础。 这是我的职责Php 控制器中的函数不工作,php,sql,codeigniter,Php,Sql,Codeigniter,我有一个具有索引功能的控制器,现在我正试图为codeignitor控制器中的滚动分页做更多的基础。 这是我的职责 public function load_more($cat2,$cat1) { $group_no = $this->input->post('group_no'); $content_per_page = 12; $start = ceil($group_no * $content_per_page);
public function load_more($cat2,$cat1)
{
$group_no = $this->input->post('group_no');
$content_per_page = 12;
$start = ceil($group_no * $content_per_page);
$all_content = $this->product__model->get_all_content($start,$content_per_page,$cat2,$cat1);
if(isset($all_content) && is_array($all_content) && count($all_content)) :
foreach ($all_content as $key => $content) :
echo '<li>'.$content->id.'</li>';
echo '<p>'.$content->ITEM_CODE.'</p>';
endforeach;
endif;
}
公共功能加载\u更多($cat2,$cat1)
{
$group_no=$this->input->post('group_no');
每页$content\u=12;
$start=ceil($group\u no*$content\u每页);
$all\u content=$this->product\u model->get\u all\u content($start,$content\u per\u page,$cat2,$cat1);
如果(isset($all_内容)&&is_数组($all_内容)&&count($all_内容)):
foreach($key=>$content形式的所有内容):
回显“”.$content->id. ”;
回显“”.$content->ITEM_CODE.”;
endforeach;
endif;
}
控制器名称为Product
当我在我的url上查看此功能时,它的“如何”页面未找到。。。
这是URL
我怎样才能解决它呢?试试这个
$route['method/(:any)/(:any)'] = 'controller/method/$1/$2';
你的路线应该是
$route['method/(:cat1)/(:cat2)'] = 'product/load_more/$1/$2';
试试这个
$route['method/(:any)/(:any)'] = 'controller/method/$1/$2';
你的路线应该是
$route['method/(:cat1)/(:cat2)'] = 'product/load_more/$1/$2';
看起来您正面临index.php的问题 请尝试使用url:
http://www.dezaro.com/index.php/Product/load_more/160/2
看起来您正面临index.php的问题 请尝试使用url:
http://www.dezaro.com/index.php/Product/load_more/160/2
问题在于你的网址。用产品代替产品
因此,使用而不是
这肯定会奏效的。因为它采用的是文件名而不是类名。问题在于您所点击的URL。用产品代替产品
因此,使用而不是
这肯定会奏效的。因为它采用文件名而不是类名。可能是路由问题$route['product/load\u more']=“product/load\u more/$1”;“我将此代码添加到route,但仍然不起作用”其有效性请尝试此(小写产品)。这是因为您用小写字母定义路由可能是路由问题$route['product/load\u more']=“product/load\u more/$1”;“我将此代码添加到route,但仍然不起作用”其有效性请尝试此(小写产品)。这是因为您用小写字母定义路由。我用htaccess隐藏路由。请共享控制器代码。bcz如果我删除load_更多,它会工作。我用HTAccesss隐藏它。请共享控制器代码。如果我卸下更多的负载,它就工作了。。但是它调用了模型中的其他函数。。但它调用了模型中的另一个函数