Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/codeigniter/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Codeigniter a href重定向到本地主机WAMP服务器_Codeigniter_Href - Fatal编程技术网

Codeigniter a href重定向到本地主机WAMP服务器

Codeigniter a href重定向到本地主机WAMP服务器,codeigniter,href,Codeigniter,Href,我是CodeIgniter的新手,尝试在主页上创建一个简单的链接,但它正在重定向到WAMP服务器上的localhost,下面是我的代码 配置文件夹中的autoload.php $autoload['helper'] = array('html', 'url'); $config['base_url'] = 'http://localhost:8080/OTI-CI'; $route['default_controller'] = 'site'; $route['404_override']

我是CodeIgniter的新手,尝试在主页上创建一个简单的链接,但它正在重定向到WAMP服务器上的localhost,下面是我的代码

配置文件夹中的autoload.php

$autoload['helper'] = array('html', 'url');
$config['base_url'] = 'http://localhost:8080/OTI-CI';
$route['default_controller'] = 'site';
$route['404_override'] = '';
$route['translate_uri_dashes'] = FALSE;
config文件夹中的config.php

$autoload['helper'] = array('html', 'url');
$config['base_url'] = 'http://localhost:8080/OTI-CI';
$route['default_controller'] = 'site';
$route['404_override'] = '';
$route['translate_uri_dashes'] = FALSE;
配置文件夹中的routes.php

$autoload['helper'] = array('html', 'url');
$config['base_url'] = 'http://localhost:8080/OTI-CI';
$route['default_controller'] = 'site';
$route['404_override'] = '';
$route['translate_uri_dashes'] = FALSE;
这是我的控制器:site.php

class Site extends CI_Controller {
    public function index() {
        $this->home();
    }

    public function home() {
        $this->load->view("header");
        $this->load->view("content_home");
        $this->load->view("footer");
    }
}
这是我的.htaccess文件

<IfModule mod_rewrite.c>

RewriteEngine On
RewriteBase /OTI-CI/

#Removes access to the system folder by users.
#Additionally this will allow you to create a System.php controller,
#previously this would not have been possible.
#'system' can be replaced if you have renamed your system folder.
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]

#When your application folder isn't in the system folder
#This snippet prevents user access to the application folder
#Submitted by: Fabdrol
#Rename 'application' to your applications folder name.
RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /index.php?/$1 [L]

#Checks to 
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]    

</IfModule>

<IfModule !mod_rewrite.c>
    # If we don't have mod_rewrite installed, all 404's
    # can be sent to index.php, and everything works as normal.
    # Submitted by: ElliotHaughin

ErrorDocument 404 /index.php

</IfModule>

重新启动发动机
重写BASE/OTI-CI/
#删除用户对系统文件夹的访问权限。
#此外,这将允许您创建System.php控制器,
#以前这是不可能的。
#如果已重命名系统文件夹,则可以替换“系统”。
重写COND%{REQUEST_URI}^系统*
重写规则^(.*)$/index.php?/$1[L]
#当应用程序文件夹不在系统文件夹中时
#此代码段阻止用户访问应用程序文件夹
#提交人:Fabdrol
#将“应用程序”重命名为应用程序文件夹名称。
重写cond%{REQUEST_URI}^应用程序*
重写规则^(.*)$/index.php?/$1[L]
#支票
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则^(.*)$index.php?/$1[L]
#如果我们没有安装mod_rewrite,所有404
#可以发送到index.php,一切正常。
#提交人:ElliotHaughin
ErrorDocument 404/index.php
这里是我的头视图,包括一个链接,如

<a href="<?php echo base_url(); ?>site/home">Home</a>


我有什么遗漏吗?

在CodeIgniter
3.x版本中,您应该将控制器、库和模型的名称大写。像那样
Site.php

错: 正确的:
CodeIgniter v2.x或v3.x的哪个版本?因此
将呈现
(请注意缺少的斜线)?你在浏览器中看到了什么?3.0.1是我得到的@BoraURL版本是
http://localhost:8080/OTI-CI/site/home
@jthemanI将控制器名称从
site.php
更改为
site.php
,同时用
站点
更新
routes.php
,最后在
中使用大写字母S,但它仍然无法解决我的问题,我正在使用以下URL
重定向到localhosthttp://localhost:8080/OTI-CI/Site/home
通过添加
index.php