找不到 Codeigniter 对象 404 EasyPHP

Codeigniter object not found 404 EasyPHP

我在使用 codeigniter 访问页面 link 时遇到问题,当从我的主屏幕导航到另一个名为 Live 的屏幕时,我收到以下错误:

Object not found!

The requested URL was not found on this server. The link on the referring page seems to be wrong or outdated. Please inform the author of that page about the error.

If you think this is a server error, please contact the webmaster.

Error 404

127.0.0.1 Apache/2.4.7 (Win32) PHP/5.4.24

主屏幕link:http://127.0.0.1/projects/公司名称/index.php/home

我试图进入的屏幕 link:http://127.0.0.1/projects/companyname/home/v_Live

home.php 控制器(底部):

class Home extends CI_Controller

{

public function __construct()

{

parent::__construct();

$this->load->helper('url');
$this->load->model('m_login');

}

public function index()

{

if($this->session->userdata('isLogin') == FALSE)

{

redirect('login/login_form');

}else

{

$this->load->model('m_login');
$user = $this->session->userdata('username');
$data['level'] = $this->session->userdata('level');
$data['user'] = $this->m_login->userData($user);
$this->load->view('home', $data);

}

--> function index () 

{ 


 function home (){
    $this->load->view("home");
    $this->load->view("v_Live");   
}

 function Live (){
    $this->load->view("home");
    $this->load->view("v_Live");    <----  
}    

}

}

}
?>

主视图:

<nav>
    <ul>
        <li><a href="home.php">Home</a></li>
        <li>
            <a href="Cloud_Clients.html">Cloud Clients<span class="caret"></span></a>
            <div>
                <ul>
                    <li><a href="<?php echo base_url(); ?>home/v_Live">Live</a></li>
                    <li><a href="PreProduction.html">Pre-Production</a></li>
                    <li><a href="Clients.html">Client Versions</a></li>
                </ul>
            </div>
        </li>
        <li><a href="about.html">About</a></li>
        <li><a href="help.html">Help</a></li>
    </ul>
</nav>

v_Live 屏幕浏览量:

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Live</title>
</head>

<body>

<nav>
    <ul>
        <li><a href="home.php">Home</a></li>
        <li>
            <a href="Cloud_Clients.html">Cloud Clients<span class="caret"></span></a>
            <div>
                <ul>
                    <li><a href="<?php echo base_url(); ?>>home/v_Live">Live</a></li>
                    <li><a href="PreProduction.html">Pre-Production</a></li>
                    <li><a href="Clients.html">Client Versions</a></li>
                </ul>
            </div>
        </li>
        <li><a href="about.html">About</a></li>
        <li><a href="help.html">Help</a></li>
    </ul>
</nav>    

<table>
    <tr>
        <th>ID</th>
        <th>Client Name</th>
        <th>App Server</th>
        <th>Instance Name</th>
    </tr>
    <?php
        foreach($records as $row):
    ?>
    <tr>
        <td><?=$row->id?></td>
        <td><?=$row->Client Name?></td>
        <td><?=$row->App Server?></td>
        <td><?=$row->Instance Name?></td>
    </tr>
    <?php
        endforeach;
    ?>
    </table>
</body>

</html>

配置文件:

$config['base_url'] = 'http://127.0.0.1/projects/**companyname**/';

/*
|--------------------------------------------------------------------------
| Index File
|--------------------------------------------------------------------------
|
| Typically this will be your index.php file, unless you've renamed it to
| something else. If you are using mod_rewrite to remove the page set this
| variable so that it is blank.
|
*/
$config['index_page'] = 'index.php';

希望这些信息足以帮助您。

谢谢

如果你的codeigniter版本是3,那么文件名应该以大写字母开头。

接下来,您是否添加了.htaccess文件??如果不使用 index.php 访问 url。 或使用以下代码从 url.

中删除 index.php
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/system.*
RewriteRule ^(.*)$ index.php?/ [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ index.php?/ [L]

在根目录中添加此文件,名称为 .htaccess。这将帮助您删除 url

中的 index.php

并删除 $config 中的 index.php 并使 $config['index_page'] = "";

并删除 base_url()。 Codeigniter 敢于识别它。