【问题标题】:Model class not found in not found in C:\wamp\www\redirect\system\core\Loader.php on line 303在第 303 行的 C:\wamp\www\redirect\system\core\Loader.php 中找不到模型类
【发布时间】:2013-11-28 14:10:43
【问题描述】:

从控制器调用模型时出现错误。 错误:- SCREAM:忽略错误抑制 (!)致命错误:在第 30 行的 C:\wamp\www\redirect\system\core\Loader.php 中找不到类“Redirection_model” 我的控制器redirection.php

<?php 

 if ( ! defined('BASEPATH')) exit('No direct script access allowed');

 class redirection extends CI_Controller {

function __construct()
{
    parent::__construct();
    //$this->layout->setLayout('layouts/main'); 
}

public function redirection_url()
{       
            if($_GET){
                $get_array = $_GET;
                $targetId = $get_array['tagid'];
                $this->load->model('redirection_model', 'redirection');
                $dynamicurl = $this->redirection->getDynamicUrl($targetId);
                if($dynamicurl){
                     $url=$dynamicurl['url'];
                     redirect($url,'refresh');
                }
                else{
                    echo "Invalid Request";
                }

            }
            else{
                echo "please pass the tagid";
               // $this->layout->view('redirection/redirection_url');

            }

    }

}

redirection_model.php

  <?

    class redirection_model extends CI_Model {

function __construct()
{
    parent::__construct();
}

function getDynamicUrl($targetId){
    $dynamicUrl= array();
    $query = $this->db->get_where('dynamic_url', array('tagid' => $targetId))->row();
    if($query){
        $dynamicUrl['url'] = $query->url;
        $dynamicUrl['userid'] = $query->userid;
                    return $dynamicUrl;
    }
            else{
                return false;
            }

}


   }

 ?>

【问题讨论】:

  • 而扩展类名必须以大写字母开头。
  • 我试过你的解决方案先生,但力能修复错误
  • 然后更新你的代码,也只是好奇:你的模型文件在模型目录中。是的?不在其他文件夹中?
  • 我的模型文件只在模型目录中。

标签: php codeigniter


【解决方案1】:

你还没有在控制器中链接你的视图,插入它。 并且还要检查你的配置文件夹中的路由文件,在那里你必须为你的功能和路由进行输入以供查看。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-12-30
    • 1970-01-01
    • 1970-01-01
    • 2013-08-12
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多