我目前正在使用版本2.1.4的代码点火器
并在config.php中说明要改变它:
$config['base_url'] = 'http://localhost/test/';
指向您网址的链接
$config['base_url'] = 'http://schoolooky.likesyou.org/';
但更改后并更改sql凭据后,我的网站上仍然出现404错误。关于我错过了什么的任何想法?
基于我本地的完整网址是:
http://schoolooky.likesyou.org/index.php/schooly/index/
我没有触及htaccess部分的任何东西,因为我不需要做任何事情。
这也是默认设置:
$config['index_page'] = 'index.php';
控制器
class Schooly extends CI_Controller {
public function index(){
$session_id = $this->session->userdata('username');
if($session_id){
$this->load->view('home.php');
}else{
$this->load->view('index');
}
}
public function admin(){
$session_id = $this->session->userdata('username');
if($session_id != "sadmin"){
if(!$session_id){
$this->load->view('index');
}else{
$this->load->view('home');
}
}else{
$this->load->view('admin.php');
}
}
public function about(){
$this->load->view('about.php');
}
public function home(){
$session_id = $this->session->userdata('username');
if($session_id != NULL){
$this->load->view('home.php');
}else{
$this->load->view('index');
}
}
public function register(){
$session_id = $this->session->userdata('username');
if($session_id == NULL){
$this->load->view('register.php');
}else{
if(!$session_id){
$this->load->view('index');
}else{
$this->load->view('home');
}
}
}
public function check(){
$this->load->model('check');
$logcheck = $this->check->check($this->input->post('username'),$this->input->post('password'));
if($logcheck == "admin"){
$this->load->view('admin.php');
}else if($logcheck == "user"){
$this->load->view('home.php');
}else{
$this->load->view('index.php');
}
}
public function ucheck(){
$this->load->model('u_check');
$rowcount = $this->u_check->check_user($this->input->post('username'));
if($rowcount == "1"){
echo "1";
}else{
echo "0";
}
}
public function regp()
{
$this->load->model('reg_p');
$reg_check = $this->reg_p->reg_user($this->input->post('firstname'),$this->input->post('lastname'),$this->input->post('username'),$this->input->post('password'));
$this->load->view('home.php');
}
public function logout()
{
$this->load->model('logout');
$this->logout->logout();
$this->load->view('index.php');
}
public function school(){
$this->load->view('school.php');
}
public function comments(){
$session_id = $this->session->userdata('username');
$this->load->model('comments');
if($session_id){
$comment = $this->comments->comments($this->input->post('comment'),$this->input->post('schoolid'));
}
echo $comment;
}
public function delcom(){
$session_id = $this->session->userdata('username');
$this->load->model('delcom');
if($session_id){
$comment1 = $this->delcom->delcom($this->input->post('id'),$this->input->post('schoolid'));
}
echo $comment1;
}
public function rate(){
$session_id = $this->session->userdata('username');
$this->load->model('rate');
if($session_id){
$rates = $this->rate->rate($this->input->post('id'),$this->input->post('value'),$this->input->post('user'));
}
echo $rates;
}
public function u_school(){
$this->load->model('u_school');
if($this->input->post('schoolid')){
$school = $this->u_school->u_school($this->input->post('schoolid'));
}else{
$school = $this->u_school->u_school1($this->input->post());
}
echo $school;
}
public function upload_s(){
$this->load->model('upload_s');
if($this->input->post('schoolname')){
$school_add = $this->upload_s->upload_s($this->input->post());
}
echo $school_add;
}
public function d_school(){
$this->load->model('d_school');
if($this->input->post('schoolid')){
$school_d = $this->d_school->d_school($this->input->post('schoolid'));
}
echo $school_d;
}
}
答案 0 :(得分:1)
应该是区分大小写的问题..
试试这个网址 click here
答案 1 :(得分:0)
请检查您是否有一个名为schooly的控制器,并且在此索引()中还检查控制器类名称的区分大小写
在schoolooky.likesyou.org的根目录上传所有codeigniter / test目录文件
设置配置: -
$config['base_url'] = 'http://schoolooky.likesyou.org/';
设置数据库: - application / config / databse.php
$db['default']['hostname'] = 'localhost'; // your host
$db['default']['username'] = 'root'; // your db username
$db['default']['password'] = ''; // your db password
$db['default']['database'] = 'eg'; // your db name
设置路线: - application / config / routes.php
$route['default_controller'] = "home"; //default on hit url
无需任何htaccess和其他默认配置
答案 2 :(得分:0)
您需要将schooly设置为默认控制器...
$route['default_controller'] = "schooly";