v5_6000 发表于 2010-7-28 23:18:35

win7与win xp 环境的问题

我是个新手。跟着教程完成了blog这个例子的view control model的例子。
在xp环境下运行都正常。但是到了win7的环境下ci就会报错,显示出blogmodel这个类的源文件,同时说这个类找不到。
有人遇到过类似情况么,如何解决?

我用的是xamp环境。
apache配置虚拟主机如下
<VirtualHost *:80>
ServerName ci
DocumentRoot "/codeCenter/ci"
   
<Directory "/codeCenter/ci">
    AddType text/html .ssi
    AddOutputFilterByType INCLUDES;DEFLATE text/html
    Options FollowSymLinks Includes IncludesNOEXEC Indexes
    DirectoryIndex index.html index.htm index.php index.shtml
    AllowOverride None
    Order Deny,Allow
    Allow from all
    RewriteEngine on
</Directory>
</VirtualHost>

Hex 发表于 2010-7-28 23:33:22

请贴一下错误信息,这个可以肯定是环境造成的了。

v5_6000 发表于 2010-8-10 16:58:01

浏览器上显示出来Blogmodel.php的源代码。下面是错误提示
错误提示是:Fatal error: Class 'Blogmodel' not found in J:\codeCenter\ci\system\libraries\Loader.php on line 187
这个文件是CI自带的文件。内容是:$CI->$name = new $model();

我觉得都显示出来这个文件的源代码了怎么会找不到呢?

64位win7旗舰版报上面的错误。32位的XP就没这问题。
我用的是XAMPP 1.7.3。win7和xp都是使用U盘上相同的Apache+PHP配置。

Hex 发表于 2010-8-10 17:22:13

你的 Blogmodel 文件命名有问题?
最好把你的代码贴上来看看。

v5_6000 发表于 2010-8-11 01:24:11

F:\codeCenter\ci\system\application\controllers\blog.php内容
<?php
class Blog extends Controller {

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

function index()
{
       $this->load->model('blogmodel');
   $this->load->view("blogview.php");
}
}
?>

F:\codeCenter\ci\system\application\models\Blogmodel.php内容
<?
class Blogmodel extends Model {

    function Blogmodel()
    {
      parent::Model();
    }
   
    function get_last_ten_entries()
    {
      echo "in get_last_ten_entries";
    }

    function insert_entry()
    {
      echo "in insert_entry";
    }

    function update_entry()
    {
      echo "in update_entry";
    }

}
?>

浏览器访问地址:http://ci/index.php/blog/

页面报错,源代码如下
<?
class Blogmodel extends Model {

    function Blogmodel()
    {
      parent::Model();
    }
   
    function get_last_ten_entries()
    {
      echo "in get_last_ten_entries";
    }

    function insert_entry()
    {
      echo "in insert_entry";
    }

    function update_entry()
    {
      echo "in update_entry";
    }

}
?><br />
<b>Fatal error</b>:Class 'Blogmodel' not found in <b>F:\codeCenter\ci\system\libraries\Loader.php</b> on line <b>187</b><br />

Hex 发表于 2010-8-11 09:44:49

-_- 你这代码没什么问题。
我也是 win7 很正常
页: [1]
查看完整版本: win7与win xp 环境的问题