【发布时间】: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 检查好工作问题解决了 :)