我在应用程序/视图和1个控制器中只创建了2个视图的新应用程序。我只想通过控制器从视图中的page1到视图中的第2页。
这是整个代码: https://www.dropbox.com/s/cytt5azgerrbsg2/Afstudeerproject.zip?dl=0
查看1:
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
?><!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Welcome to CodeIgniter</title>
</head>
<body>
<div id="container">
<h1>Welcome to CodeIgniter!</h1>
<div id="body">
<?= form_open(site_url('Welcome/steven')) ?>
<input type="file" name="userfile" />
<p><input type="submit" value="submit" name="submit" /></p>
<?= form_close() ?>
</div>
</div>
</body>
</html>
观点2:
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
?><!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Welcome to CodeIgniter</title>
</head>
<body>
<div id="container">
<h1>Welcome to CodeIgniter!</h1>
<div id="body">
<?= form_open(site_url('welcome')) ?>
<input type="file" name="userfile" />
<p><input type="submit" value="submit" name="submit" /></p>
<?= form_close() ?>
</div>
</div>
</body>
</html>
控制器:
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Welcome extends CI_Controller {
public function index() {
$this->load->view('welcome_message');
}
public function steven() {
$this->load->view('welcome_secondpage');
}
}
routes.php文件:
$route['default_controller'] = 'welcome';
$route['404_override'] = '';
$route['translate_uri_dashes'] = FALSE;
的config.php:
$config['index_page'] = '';
$config['base_url'] = '';
autoload.php:
$autoload['helper'] = array('form' , 'url');
其余文件都是标准的CodeIgnitor
答案 0 :(得分:0)
在配置文件中指定此$config['index_page'] = 'index.php';