我不知道我错过了什么。我刚刚在codeigniter中重新开始。我不知道接下来我会做什么。我已经修复了base_url = localhost_cpu,我的主文件夹是Cpu。你们中的任何人都知道如何修复我的代码。每次我点击提交按钮,它都会说找不到对象。
.htacess
RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
配置
的config.php
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
$config['base_url'] = 'http://localhost/Cpu';
$config['index_page'] = '';
$config['uri_protocol'] = 'REQUEST_URI';
$config['url_suffix'] = '';
$config['language'] = '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['enable_query_strings'] = FALSE;
$config['controller_trigger'] = 'c';
$config['function_trigger'] = 'm';
$config['directory_trigger'] = 'd';
$config['allow_get_array'] = TRUE;
$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'] = '';
$config['cookie_domain'] = '';
$config['cookie_path'] = '/';
$config['cookie_secure'] = FALSE;
$config['cookie_httponly'] = 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'] = 'Scheduling';
$route['404_override'] = '';
$route['translate_uri_dashes'] = FALSE;
autoload.php
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
$autoload['packages'] = array();
$autoload['libraries'] = array('session','database','form_validation');
$autoload['drivers'] = array();
$autoload['helper'] = array('url','form','html');
$autoload['config'] = array();
$autoload['language'] = array();
$autoload['model'] = array();
模型
Scheduling_model.php
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Scheduling_model extends CI_Model {
public function __construct(){
parent::__construct();
}
}
*controller*
**Scheduling.php**
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Scheduling extends CI_Controller{
public function __construct(){
parent::__construct();
$this->load->model('scheduling_model');
}
public function index(){
$this->first();
}
public function first(){
$this->load->view('first.php');
}
public function priority(){
$this->load->view('second.php');
}
}
视图
first.php
<?php echo form_open("priority"); ?>
Enter no of process
<input type="text" name="processes" value="<?php echo set_value('processes')?>" >
<input type="submit" value="Submit">
<?php
echo form_close();
?>