【问题标题】:Ajax Post php class not loading problems?Ajax Post php 类没有加载问题?
【发布时间】:2017-07-22 14:17:05
【问题描述】:

您好,我的问题 ajax 发布后 php 扩展类未加载。 没有找到commfuct。 发送正常(不使用ajax)表单没有问题。

page.php 用户界面

include_once("comment.class.php");
$new =new yorum();
$new->commentform($id,$cat);//for example

comment.php Ajax 发布页面

inlcude_once("comment.class.php"); 
$new= new comment(); 
if(iseet($_POST)) 
{ 
$cek= $new->yorumkontrol("sa","as@a.com",7,"12sdeaege","bu bir yorum"); 
if(isset($cek["hata"])) 
{ 
echo $cek["hata"]; 
} 
} 
?>

类.php php Class文件加载函数

class dahilet
{
function autoload($gelen) 
    { 
        $dy=__DIR__."/".$gelen.".sinif.php"; 
        if(file_exists($dy)) 
        { 
            include_once($dy); 
        } 
        else 
        { 
             
            die("$gelen not found."); 
        } 
    }
}
$dosyaknt=new dahilet();
spl_autoload_register(array($dosyaknt,'autoload'));

comment.class.php 评论类索引 评论表单功能
评论表单控制功能
注释添加数据库功能
商品类索引
评论分类控制功能
评论机器人控制功能
评论 gravatar 控制功能
评论google recaptcha控制功能

include_once("class.php");
$dh= new dahilet(); 
$dh->autoload("db"); 
class comment extends  commfunct 
    { 
    function yorumkontrol($a,$b,$c,$d,$e) 
    { 
    $na= self::konumsor($a,$b);
return $na;//for example
    } 
    
    } 
    class commfunct extends baglan 
    { 
      function konumsor($a,$b) 
      { 
      $sql="select * from linksistem where id=:idal,cid=:cidal order by sira asc limit 1"; 
       $sor=$db->prepare($sql); 
       $sor->execute(array("idal"=>$a,"cidal"=>$b)) 
       if(isset($sor->errorInfo()[2])) 
        { 
         if($sor->rowCount()>0) 
         { return false;} 
        else {return true;} 
        } 
       else{return false;} 
      } 
    } 
    ?>

【问题讨论】:

  • 将您的commfunt类代码放在评论类代码之前并检查
  • 你检查了吗
  • @Anant 检查好工作问题解决了 :)

标签: php jquery ajax


【解决方案1】:

你扩展了类commfunct。这里

class comment extends commfunct

但是这个commfunct 类代码在这一行下面,这就是commfunct class not found 错误即将到来的原因

解决方案:-

将您的 commfunct 类代码放在 extends 行之前,您会很高兴

【讨论】:

  • 很高兴为您提供帮助:):)
猜你喜欢
  • 1970-01-01
  • 2014-03-17
  • 1970-01-01
  • 2015-01-11
  • 2010-12-21
  • 2016-05-26
  • 1970-01-01
  • 1970-01-01
  • 2014-08-28
相关资源
最近更新 更多