簡體   English   中英

Codeigniter導航不起作用

[英]Codeigniter navigation doesn't work

我創建了一個新應用程序,該應用程序中只有2個視圖/一個控制器。 我只想通過控制器從視圖的第1頁轉到視圖的第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');
    }
}

route.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

在您的配置文件中分配此$config['index_page'] = 'index.php';

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM