在此服务器上找不到请求的URL。在php codeigniter上

问题描述 投票:0回答:1

我是codeigniter的初学者,我正在尝试建立一个库存系统。仪表板已经准备就绪,但是当我点击仪表板上的一个按钮时出现错误,它没有加载新产品视图我定义路线尝试了很多但没有正面结果

这是我的控制器

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

class Dashboard extends CI_Controller {

    public function _construct(){
        parent::_construct();
        $this->load->database();

        $this->load->model("m_inventory");
        $this->load->helper('form');
        $this->load->library('form_validation');
    }

    public function add_items(){
        $this->load->view('newproduct');
    }
}

和我的仪表板视图

<div class="form">
    <h2>Inventory System</h2>
    <div class="button1">
        <a title="New account" href='<?php echo base_url ('dashboard/add_items'); ?>New product</a> 
    </div> 
    <div class="button2">
        <input type="submit" name="submit" value="Current Stock" > 
    </div>
</div>
php codeigniter
1个回答
0
投票
  1. 确认是否在application / config / autoload.php中加载了url helper,因为你使用的是base_url()
  2. 您的视图文件名应为newproduct.php
  3. 通过在base url之后添加/删除index.php来检查。

如果上面没有帮助你,那么分享你得到的错误和CI版本。

© www.soinside.com 2019 - 2024. All rights reserved.