Fatal error: Class 'fenye' not found in C:\xampp\workspace\LiuYanBan\chakan.php on line 11
<?php
//实现分页的类class fenye{
var $page_size;    //每页的记录数
var $pageNumber;   //当前页面的页码
var $pageEnd;      //该页面末尾
var $pageStar;     //该页面开始的位置
var $pageCount;    //页面的总数量
//var $shuju;        //总共有多少数据量
var $shouye=1;     //首页面
var $weiye;         //尾页面
var $prePage;       //上一页
var $nextPage;      //下一页
function fenye(){}  //无参构造函数function fenye($page_size,$pageNumber)
{
$this->page_size=$page_size;
$this->pageNumber=$pageNumber;
$this->pageStar=($pageNumber-1)*$page_size;
$this->pageEnd=($pageNumber*$page_size)-1;}
function set_pagesize($pagesize)   //设置页面的记录数
{
if($pagesize>0){
 $this->page_size=$pagesize;
}else
$this->page_size=5;
}
function get_pagesize()         //获取页面的记录数
{
  return $this->page_size;
}function set_pageNumber($pageNumber)   //设置当前页面的页码
{
if($pageNumber>=1&&$pageNumber<=$this->weiye){
$this->pageNumber=$pageNumber;
}
}
function get_pageNumber()       //获取当前页面的页码
{
  return $this->pageNumber;
}
function set_pageCount($shujuliang)   //设置页面数量
{
if($shujuliang>0){
   $this->pageCount=ceil($shujuliang/$this->page_size);
}
}
function get_pageCount()       //获取页面数量
{
  return $this->pageCount;
}
function get_pageEnd()
{
  return $this->pageEnd;
}
function get_pageStar()
{
return $this->pageStar;
}}
?>

解决方案 »

  1.   

    多数是没有把类文件include包含进去
    还有chakan.php的11行是什么?
      

  2.   

    <html>
    <head></head>
    <body>
    <?php
    $id=$_GET["id"];
    $yema=$_GET["yema"];echo $id;
    $shuliang=0;
    //初始化页面
    $s=new fenye();
    //根据id进行查询主题信息
    $link=mysql_connect("localhost","root","");
    mysql_select_db("lyb",$link);
    $sql="select * from zhuti as z inner join users as u on z.uid=u.id where z.zid=".$id;
    $query=mysql_query($sql,$link);
    while($arr=mysql_fetch_array($query))
    {
       $shuliang=$arr["z_rnum"];?><table width="567" border="1">
      <tr>
        <td rowspan="2"><?php echo $arr["name"]; ?></td>
        <td><?php echo $arr["ztitle"]; ?></td>
      </tr>
      <tr>
        <td><?php echo $arr["zcontent"]; ?></td>
      </tr>
    </table>
    <?php
    }
    $sql="select * from replace as r inner join users as u on r.uid=u.id where r.zid=".$id." limit ".$s->get_pageStar()." to ".$s->get_pageEnd();
    $result=mysql_query($sql,$link);
    $s->set_pageCount(mysql_fetch_row($result));
    if($result){
    while($arr=mysql_fetch_array($result))
    {
      ?>
     <table width="567" border="1">
      <tr>
        <td rowspan="2"><?php echo $arr["name"]; ?></td>
        <td><?php echo $arr["rtime"]; ?></td>
      </tr>
      <tr>
        <td><?php echo $arr["rcontent"]; ?></td>
      </tr>
    </table>
    <?php}
    }
     ?>
     <div>
      <span><a href="chakan.php?yema=<?php echo $yema ?>&id=<?php echo $id; ?>">上一页</a></span>
     </div>
     <div>
     <form action="doreplace.php" method="post">
       <span>回复该主题</span>
       <li><input type="hidden" name="num" value="<?php echo $shuliang; ?>" /></li>
       <li><input type="hidden" name="id"  value="<?php echo $id; ?>" /></li>
       <li>姓名:<input type="text" name="name" /></li>
       <li>内容:<textarea name="textarea" ></textarea></li>
       <input type="submit" value="发表回复"  /><input type="reset" value="重 置" />
       
       
     </form></div>
     
     
    </body></html>
      

  3.   

    类没有引入,而且你应该帖 chakan.php 的代码啊!~
      

  4.   


    在这里 ...<?php$id=$_GET["id"];
    $yema=$_GET["yema"];include_once('类文件的路径');  //添加这句
      

  5.   

    是绝对路径还是相对?好象不行
    Warning: include_once(\LiuYanBan\Test.php) [function.include-once]: failed to open stream: No such file or directory in C:\xampp\workspace\LiuYanBan\chakan.php on line 7
    Warning: include_once() [function.include]: Failed opening '\LiuYanBan\Test.php' for inclusion (include_path='.;C:\xampp\php\pear\') in C:\xampp\workspace\LiuYanBan\chakan.php on line 7
    11
    Fatal error: Class 'fenye' not found in C:\xampp\workspace\LiuYanBan\chakan.php on line 11
      

  6.   

    没有写对吧 放在同一个目录下 这样 include_once("page.php");
      

  7.   

    Fatal error: Cannot redeclare fenye::fenye() in C:\xampp\workspace\LiuYanBan\Test.php on line 17
    怎么会重复声明呢?郁闷死了
      

  8.   

    重复引用? 都用了include_once?
      

  9.   

    引入一次就行了,可以开始的时候引用include_once('文件名');  看看是不是在同一个目录下面,如果在的话,可以直接写文件名。
      

  10.   

    $id=$_GET["id"];
    $yema=$_GET["yema"];
    include("Test.php");echo $id;报上面的异常....
    $shuliang=0;
    //初始化页面
    //$s=new fenye();
    //根据id进行查询主题信息
    $link=mysql_connect("localhost","root","");
    mysql_select_db("lyb",$link);
    $sql="select * from zhuti as z inner join users as u on z.uid=u.id where z.zid=".$id;
    $query=mysql_query($sql,$link);
    while($arr=mysql_fetch_array($query))
    {
       $shuliang=$arr["z_rnum"];?><table width="567" border="1">
      <tr>
        <td rowspan="2"><?php echo $arr["name"]; ?></td>
        <td><?php echo $arr["ztitle"]; ?></td>
      </tr>
      <tr>
        <td><?php echo $arr["zcontent"]; ?></td>
      </tr>
    </table>
    <?php
    }
    //$sql="select * from replace as r inner join users as u on r.uid=u.id where r.zid=".$id." limit ".$s->get_pageStar()." to ".$s->get_pageEnd();
    $sql="select * from replace as r inner join users as u on r.uid=u.id where r.zid=".$id;
    $result=mysql_query($sql,$link);
    //$s->set_pageCount(mysql_fetch_row($result));
    if($result){
    while($arr=mysql_fetch_array($result))
    {
      ?>
     <table width="567" border="1">
      <tr>
        <td rowspan="2"><?php echo $arr["name"]; ?></td>
        <td><?php echo $arr["rtime"]; ?></td>
      </tr>
      <tr>
        <td><?php echo $arr["rcontent"]; ?></td>
      </tr>
    </table>
    <?php}
    }
     ?>
     <div>
      <span><a href="chakan.php?yema=<?php echo $yema ?>&id=<?php echo $id; ?>">上一页</a></span>
     </div>
     <div>
     <form action="doreplace.php" method="post">
       <span>回复该主题</span>
       <li><input type="hidden" name="num" value="<?php echo $shuliang; ?>" /></li>
       <li><input type="hidden" name="id"  value="<?php echo $id; ?>" /></li>
       <li>姓名:<input type="text" name="name" /></li>
       <li>内容:<textarea name="textarea" ></textarea></li>
       <input type="submit" value="发表回复"  /><input type="reset" value="重 置" />
       
       
     </form></div>
     
     
    </body></html>
      

  11.   

    最好设置一个总目录变量queryphp orm数据库类
    ---------------------------------------------
    http://topic.csdn.net/u/20100310/11/62a60067-b3da-4dee-9d6a-f1baeb2f3f33.html
      

  12.   

    ...
    var $nextPage; //下一页
    function fenye(){} //无参构造函数function fenye($page_size,$pageNumber)
    {
    $this->page_size=$page_size;
    ...红色部分显然是错误的!
      

  13.   


    fenye::fenye()是静态调用, 如果这个fenye不是静态方法应该用new声明一个对象调用。