【发布时间】:2014-03-28 16:28:52
【问题描述】:
我的问题是我得到的响应都是空的..
在我的订阅者文件中,我有一个类,其中包含一个函数和一个选择所有用户的查询。
在我的 cmets 文件中,我有一个类,其中包含一个函数和一个插入注释的查询
if(isset($_POST['task']) && $_POST['task']=='comment_insert'){
$userId = (int)$_POST ['userId'];
$comment = addslashes($_POST ['comment']);
$std = new stdClass();
$std->user= null;
$std->userId= null;
$std->comment= null;
$std->error=false ;
require_once( "subscribers.php" );
require_once( "comments.php" );
require_once( "db_conx.php" );
if ( class_exists( 'Comments ' ) && class_exists( 'Subscribers'))
{
$userInfo = Subscribers::getSubscriber($userId);
if($userId == null)
{
$std-> error = true ;
}
$commentInfo = Comments::insert($comment, $userId);
if($commentsInfo != null )
{
$std->error = true ;
}
$std->user = $userInfo;
$std->comment = $commentInfo;
}
echo json_encode($std);
}
else
{
die;
}
?>
【问题讨论】:
-
你有一个错字 $std-> error = true ;并不是说它与您的问题有任何关系,只是提醒一下。