[英]Codeigniter navigation doesn't work
I made a new application with just 2 views in application/views and 1 controller. 我创建了一个新应用程序,该应用程序中只有2个视图/一个控制器。 I just want to go from page1 in view to page2 in view via the controller.
我只想通过控制器从视图的第1页转到视图的第2页。
here is the whole code: https://www.dropbox.com/s/cytt5azgerrbsg2/Afstudeerproject.zip?dl=0 这是完整的代码: https : //www.dropbox.com/s/cytt5azgerrbsg2/Afstudeerproject.zip?dl=0
view 1: 视图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>
view 2: 查看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>
controller: 控制器:
<?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.php:
$route['default_controller'] = 'welcome';
$route['404_override'] = '';
$route['translate_uri_dashes'] = FALSE;
config.php: config.php:
$config['index_page'] = '';
$config['base_url'] = '';
autoload.php: autoload.php:
$autoload['helper'] = array('form' , 'url');
the rest of the files are all standard CodeIgnitor 其余文件均为标准CodeIgnitor
在您的配置文件中分配此$config['index_page'] = 'index.php';
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.