如何在Codeigniter3中修复其他控制器的URL

时间:2019-07-07 16:58:47

标签: apache ubuntu-14.04 codeigniter-3

我正在使用frimework codeignter3设置新网站,我已经有一个默认的控制器,名称为“ home”,并且工作正常,但是当我尝试创建新的控制器“ activecode”时,我无法访问视图。

该网站运行在:Ubuntu 14.04,使用apache2和php,使用codeigniter 3

我的控制器:Codeactive.php

#include <iostream>

struct Atom {
public:
    Atom(int type, double x, double y, double z) : type_(type), x_(x), y_(y), z_(z) {}  
    int     type_;
    double  x_;
    double  y_;
    double  z_;
};

std::ostream& operator<<(std::ostream &strm, const Atom &atom) {
    return strm << atom.type_ << " " << atom.x_ << " " << atom.y_ << " " << atom.z_ << std::endl;
}

void print_atom(Atom atom)
{
  std::cout << atom << std::endl;
}

extern "C"
{
  Atom* Atom_init(int type, double x, double y, double z)
  {
    return new Atom(type, x, y, z);
  }
  void py_print_atom(Atom atom){print_atom(atom);}
}

我的配置:

<?php
class Codeactive extends CI_Controller {
   public function __construct()
   {
       parent::__construct();

       $this->load->database();
       $this->load->helper('url');
         }
  public function index() {
   if ( ! file_exists(APPPATH.'/views/pages/ca.php')) {
      //Whoops, we don't have a page for that!
     show_404();
    }       
    $data['title'] = ucfirst('Codeactive'); 
    $this->load->view('templates/header', $data);
    $this->load->view('templates/menu', $data);
    $this->load->view('pages/ca', $data);
    $this->load->view('templates/footer', $data);
  }
}

我的route.php:

$config['base_url'] = 'http://revendeur.pro/';
$config['index_page'] = '';
$config['uri_protocol'] = 'REQUEST_URI';


我的htaccess:

$route['default_controller'] = 'home';
$route['translate_uri_dashes'] = FALSE;
$route['codeactive/list'] = 'ca/list';

我尝试了google中的所有原理,并且没有任何改变。

0 个答案:

没有答案