[Codeigniter-users] modelを呼べない

Back to archive index

ikari****@ecoin***** ikari****@ecoin*****
2009年 5月 31日 (日) 16:37:17 JST


碇です

大文字になっていたようなので
$this->load->model('ModelTest');
に直しても呼べませんでした

ファイル名がおかしいのかと思い
modeltest.php
class Modeltest extends Model{
        function __construct(){
                parent::Model();
        }
        function getdata(){
                return "test";
        }
}

test.php
<?php
class Test extends Controller {

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

        function index()
        {
                $this->load->model('Modeltest');
                //$a = Testmodel->get_data();
                echo "$a";
        }
}

としてみましたがやはり
class Modeltest extends Model{ function __construct(){ parent::Model(); } function getdata(){ return "test"; } }
Fatal error: Class 'Modeltest' not found in /var/www/ci/system/libraries/Loader.php on line 184

と言われてしまいます


On Sun, 31 May 2009 16:26:37 +0900
Takeshi Amano <p****@takes*****> 様wrote:

> 天野です
> 
> 正しいモデル名でロードされていないようなので。
> 
> $this->load->model('Testmodel');
> 
>> 
> $this->load->model('ModelTest');
> 
> してみてはいかがでしょう?
> 
> 
> 
> 2009/5/31  <ikari****@ecoin*****>:
> > 碇と申します
> >
> > DocumentRootにciとしてCI1.7を展開しました
> >
> > /var/www/ci/system/application/config/config.php
> > $config['base_url']     = "http://example.jp/ci/"
> > に変更
> >
> > /var/www/ci/system/application/controllers/test.php
> >
> > <?php
> > class Test extends Controller {
> >
> >        function __construct()
> >        {
> >                parent::Controller();
> >        }
> >
> >        function index()
> >        {
> >                $this->load->model('Testmodel');
> >               // $a = Testmodel->get_data();
> >                echo "$a";
> >        }
> > }
> >
> > /var/www/ci/system/application/models/modeltest.php
> > class ModelTest extends Model{
> >        function __construct(){
> >                parent::Model();
> >        }
> >        function getdata(){
> >                return "test";
> >        }
> > }
> >
> > これで
> > http://example.jp/ci/index.php/test
> > を呼ぶと
> > Fatal error: Class 'Testmodel' not found in /var/www/ci/system/libraries/Loader.php on line 184
> > となります
> >
> > 何をチェックすればいいでしょうか?
> >
> > --
> > 碇 永志
> >  <ikari****@ecoin*****>
> >
> > _______________________________________________
> > Codeigniter-users mailing list
> > Codei****@lists*****
> > http://lists.sourceforge.jp/mailman/listinfo/codeigniter-users
> >
> 
> 
> 
> -- 
> Takeshi Amano
> 
> Ik heb geluk!
> 
> _______________________________________________
> Codeigniter-users mailing list
> Codei****@lists*****
> http://lists.sourceforge.jp/mailman/listinfo/codeigniter-users

-- 
碇 永志
 <ikari****@ecoin*****>




Codeigniter-users メーリングリストの案内
Back to archive index