2016-09-29 4 views
0

Pages.php в папке контроллераОбъект не найден! -ошибка 404-CodeIgniter-XAMPP сервер

<?php 
 
defined('BASEPATH') OR exit('No direct script access allowed'); 
 

 
class Pages extends CI_Controller { 
 

 
\t public function index() { 
 
     $this->load->view('header'); 
 
     $this->load->view('home'); 
 
     $this->load->view('footer'); 
 
\t } 
 
\t public function fivespecies() { 
 
     $this->load->view('header'); 
 
     $this->load->view('fivespecies'); 
 
     $this->load->view('footer'); 
 
\t } 
 
\t 
 
}

autoload.php в папке конфигурации

<?php 
 
defined('BASEPATH') OR exit('No direct script access allowed'); 
 

 

 

 

 
$autoload['packages'] = array(); 
 

 

 
$autoload['libraries'] = array(); 
 

 

 
$autoload['drivers'] = array(); 
 

 

 
$autoload['helper'] = array('url'); 
 

 

 
$autoload['config'] = array(); 
 

 

 
$autoload['language'] = array(); 
 

 

 
$autoload['model'] = array();

config.php в папке конфигурации

<?php 
 
defined('BASEPATH') OR exit('No direct script access allowed'); 
 

 

 
$config['base_url'] = 'http://localhost/antimalarial/'; 
 

 

 
$config['index_page'] = ''; 
 

 

 
$config['uri_protocol'] \t = 'REQUEST_URI'; 
 

 

 
$config['url_suffix'] = ''; 
 

 

 
$config['language'] \t = 'english'; 
 

 

 
$config['charset'] = 'UTF-8'; 
 

 

 
$config['enable_hooks'] = FALSE; 
 

 

 
$config['subclass_prefix'] = 'MY_'; 
 

 

 
$config['composer_autoload'] = FALSE; 
 

 

 
$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-'; 
 

 

 
$config['allow_get_array'] = TRUE; 
 
$config['enable_query_strings'] = FALSE; 
 
$config['controller_trigger'] = 'c'; 
 
$config['function_trigger'] = 'm'; 
 
$config['directory_trigger'] = 'd'; 
 

 

 
$config['log_threshold'] = 0; 
 

 

 
$config['log_path'] = ''; 
 

 

 
$config['log_file_extension'] = ''; 
 

 

 
$config['log_file_permissions'] = 0644; 
 

 

 
$config['log_date_format'] = 'Y-m-d H:i:s'; 
 

 

 
$config['error_views_path'] = ''; 
 

 

 
$config['cache_path'] = ''; 
 

 

 
$config['cache_query_string'] = FALSE; 
 

 
$config['encryption_key'] = ''; 
 

 

 
$config['sess_driver'] = 'files'; 
 
$config['sess_cookie_name'] = 'ci_session'; 
 
$config['sess_expiration'] = 7200; 
 
$config['sess_save_path'] = NULL; 
 
$config['sess_match_ip'] = FALSE; 
 
$config['sess_time_to_update'] = 300; 
 
$config['sess_regenerate_destroy'] = FALSE; 
 

 

 
$config['cookie_prefix'] \t = ''; 
 
$config['cookie_domain'] \t = ''; 
 
$config['cookie_path'] \t \t = '/'; 
 
$config['cookie_secure'] \t = FALSE; 
 
$config['cookie_httponly'] \t = FALSE; 
 

 

 
$config['standardize_newlines'] = FALSE; 
 

 

 
$config['global_xss_filtering'] = FALSE; 
 

 

 
$config['csrf_protection'] = FALSE; 
 
$config['csrf_token_name'] = 'csrf_test_name'; 
 
$config['csrf_cookie_name'] = 'csrf_cookie_name'; 
 
$config['csrf_expire'] = 7200; 
 
$config['csrf_regenerate'] = TRUE; 
 
$config['csrf_exclude_uris'] = array(); 
 

 

 
$config['compress_output'] = FALSE; 
 

 

 
$config['time_reference'] = 'local'; 
 

 

 
$config['rewrite_short_tags'] = FALSE; 
 

 

 
$config['proxy_ips'] = '';

routes.php в папке конфигурации

<?php 
 
defined('BASEPATH') OR exit('No direct script access allowed'); 
 

 

 
$route['default_controller'] = 'pages'; 
 
$route['404_override'] = ''; 
 
$route['translate_uri_dashes'] = FALSE; 
 
$route['(:any)'] = 'pages/$1/$1';

header.php

<!-- === BEGIN HEADER === --> 
 
<!DOCTYPE html> 
 
<!--[if IE 8]> <html lang="en" class="ie8"> <![endif]--> 
 
<!--[if IE 9]> <html lang="en" class="ie9"> <![endif]--> 
 
<!--[if !IE]><!--> 
 
<html lang="en"> 
 
    <!--<![endif]--> 
 
    <head> 
 
     <!-- Title --> 
 
     <title>Database for antimalarial Drug</title> 
 
     <!-- Meta --> 
 
     <meta http-equiv="content-type" content="text/html; charset=utf-8" /> 
 
     <meta name="description" content=""> 
 
     <meta name="author" content=""> 
 
     <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" /> 
 
     <!-- Favicon --> 
 
     <link href="favicon.ico" rel="shortcut icon"> 
 
     <!-- Bootstrap Core CSS --> 
 
     <link rel="stylesheet" href="assets/css/bootstrap.css" rel="stylesheet"> 
 
     <!-- Template CSS --> 
 
     <link rel="stylesheet" href="assets/css/animate.css" rel="stylesheet"> 
 
     <link rel="stylesheet" href="assets/css/font-awesome.css" rel="stylesheet"> 
 
     <link rel="stylesheet" href="assets/css/nexus.css" rel="stylesheet"> 
 
     <link rel="stylesheet" href="assets/css/responsive.css" rel="stylesheet"> 
 
     <link rel="stylesheet" href="assets/css/custom.css" rel="stylesheet"> 
 
     <!-- Google Fonts--> 
 
     <link href="http://fonts.googleapis.com/css?family=Roboto+Condensed:400,300" rel="stylesheet" type="text/css"> 
 
    </head> 
 
    <body> 
 
     <div id="body-bg"> 
 
      <!-- Phone/Email --> 
 
      <div id="pre-header" class="background-gray-lighter"> 
 
       <div class="container no-padding"> 
 
        <div class="row hidden-xs"> 
 
         <div class="col-sm-6 padding-vert-5"> 
 
          <strong>Phone:</strong>&nbsp;9030051219 
 
         </div> 
 
         <div class="col-sm-6 text-right padding-vert-5"> 
 
          <strong>Email:</strong>&nbsp;[email protected] 
 
         </div> 
 
        </div> 
 
       </div> 
 
      </div> 
 
      <!-- End Phone/Email --> 
 
      <!-- Header --> 
 
      <div id="header"> 
 
       <div class="container"> 
 
        <div class="row"> 
 
         <!-- Logo --> 
 
         <div class="logo"> 
 
          <a href="index.html" title=""> 
 
           <img src="assets/img/logo1.png" alt="Logo" /> 
 
          </a> 
 
         </div> 
 
         <!-- End Logo --> 
 
        </div> 
 
       </div> 
 
      </div> 
 
      <!-- End Header --> 
 
      <!-- Top Menu --> 
 
      <div id="hornav" class="bottom-border-shadow"> 
 
       <div class="container no-padding border-bottom"> 
 
        <div class="row"> 
 
         <div class="col-md-8 no-padding"> 
 
          <div class="visible-lg"> 
 
           <ul id="hornavmenu" class="nav navbar-nav"> 
 
            <li> 
 
             <a href="<?php echo base_url() ?>home">home</a> 
 
            </li> 
 
            <li> 
 
             <span class="fa-gears ">Malaria</span> 
 
             <ul> 
 
              
 
              
 
            
 
              <li> 
 
               <a href="<?php echo base_url() ?>fivespecies">fiveSpecies</a> 
 
              </li> 
 
              <li> 
 
               <a href="features-accordions-tabs.html">Parasite life cycle</a> 
 
              </li> 
 
              <li> 
 
               <a href="features-buttons.html">Definite and symptoms</a> 
 
              </li> 
 
              <li> 
 
               <a href="features-carousels.html">Current tools</a> 
 
              </li> 
 
              <li> 
 
               <a href="features-grid.html">Malaria Treatment</a> 
 
              </li> 
 
              <li> 
 
               <a href="features-animate-on-scroll.html">History of antimalarials</a> 
 
              </li> 
 
             </ul> 
 
            </li> 
 
            <li> 
 
             <span class="fa-copy ">Access</span> 
 
             <ul> 
 
              <li> 
 
               <a href="pages-about-us.html">Areas of work</a> 
 
              </li> 
 
              <li> 
 
               <a href="pages-services.html">Map of Projects</a> 
 
              </li> 
 
              <li> 
 
               <a href="pages-faq.html">Products</a> 
 
              </li> 
 
              <li> 
 
               <a href="pages-about-me.html">Tool kits</a> 
 
              </li> 
 
              <li> 
 
               <a href="pages-full-width.html">Global malaria mapper</a> 
 
              </li> 
 
              <li> 
 
               <a href="pages-left-sidebar.html">Access interviews</a> 
 
              </li> 
 
             </ul> 
 
            </li> 
 
            <li> 
 
             <span class="fa-th ">News room</span> 
 
             <ul> 
 
              <li> 
 
               <a href="portfolio-2-column.html">News</a> 
 
              </li> 
 
              <li> 
 
               <a href="portfolio-3-column.html">Press Releases</a> 
 
              </li> 
 
              <li> 
 
               <a href="portfolio-4-column.html">Publications</a> 
 
              </li> 
 
              <li> 
 
               <a href="portfolio-6-column.html">Events</a> 
 
              </li> 
 
             </ul> 
 
            </li> 
 
            <li> 
 
             <span class="fa-font ">Blog</span> 
 
             <ul> 
 
              <li> 
 
               <a href="blog-list.html">Blog</a> 
 
              </li> 
 
              <li> 
 
               <a href="blog-single.html">Blog Single Item</a> 
 
              </li> 
 
             </ul> 
 
            </li> 
 
            <li> 
 
             <a href="contact.html" class="fa-comment ">Drugs</a> 
 
            </li> 
 
           </ul> 
 
          </div> 
 
         </div> 
 
         <div class="col-md-4 no-padding"> 
 
          <ul class="social-icons pull-right"> 
 
           <li class="social-youtube"> 
 
            <a href="https://www.youtube.com/user/MMVMeds4Malaria" target="_blank" title="Youtube"></a> 
 
           </li> 
 
           <li class="social-twitter"> 
 
            <a href="https://twitter.com/MalariaNoMore?lang=en" target="_blank" title="Twitter"></a> 
 
           </li> 
 
           <li class="social-facebook"> 
 
            <a href="https://www.facebook.com/pages/Antimalarial-medication/111604075529955" target="_blank" title="Facebook"></a> 
 
           </li> 
 
           <li class="social-googleplus"> 
 
            <a href="https://plus.google.com/114702323662314783325" target="_blank" title="Google+"></a> 
 
           </li> 
 
          </ul> 
 
         </div> 
 
        </div> 
 
       </div> 
 
      </div> 
 
      <!-- End Top Menu --> 
 
      <!-- === END HEADER === -->

, когда я нажимаю на fivespecies он показывает (объект не найден ошибка) image

файл .htaccess

RewriteEngine On 
 
RewriteCond %{REQUEST_FILENAME} !-f 
 
RewriteCond %{REQUEST_FILENAME} !-d 
 
RewriteRule ^(.*)$ index.php/$1 [L]

+1

Попробуйте с именем файла не Welcome.php welcome.php – user4419336

+0

все еще получаю ту же ошибку –

ответ

0

Убедитесь, что у вас есть установите свой базовый url в config.php

/* 
|-------------------------------------------------------------------------- 
| Base Site URL 
|-------------------------------------------------------------------------- 
| 
| URL to your CodeIgniter root. Typically this will be your base URL, 
| WITH a trailing slash: 
| 
| http://example.com/ 
| 
| WARNING: You MUST set this value! 
| 
| If it is not set, then CodeIgniter will try guess the protocol and path 
| your installation, but due to security concerns the hostname will be set 
| to $_SERVER['SERVER_ADDR'] if available, or localhost otherwise. 
| The auto-detection mechanism exists only for convenience during 
| development and MUST NOT be used in production! 
| 
| If you need to allow multiple domains, remember that this file is still 
| a PHP script and you can easily do that on your own. 
| 
*/ 

$config['base_url'] = 'http://localhost/yourproject/'; 

И попробуйте этот htaccess разместить его вне папки приложения. Я использую xampp на окнах, и этот htaccess в порядке.

Options +FollowSymLinks 
Options -Indexes 
DirectoryIndex index.php 
RewriteEngine on 
RewriteCond $1 !^(index\.php|images|robots\.txt) 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ index.php/$1 [L,QSA] 

Если вы используете CI 3 он не имеет автоматического здесь

$config['uri_protocol'] = 'AUTO'; 

Изменения в

$config['uri_protocol'] = 'REQUEST_URI'; 
+0

что мне нужно установить базовый url в config.php –

+0

Он говорит, чтобы сделать это плюс, если вы не используете свои ссылки css и изображений несколько раз не обнаружит – user4419336

+0

еще gett такая же ошибка –

Смежные вопросы