phpcms的评论数为啥这样写不行呢

WBOY
Release: 2016-06-23 13:41:25
Original
797 people have browsed it

取不到值,怪了.应该没错啊

<?phpdefined('IN_PHPCMS') or exit('No permission resources.'); /** * 点击统计 */$db = '';$db = pc_base::load_model('comment_model');if($_GET['modelid'] && $_GET['id']) {	$model_arr = array();	$model_arr = getcache('model','commons');	$modelid = intval($_GET['modelid']);	$commentid = 'content_'.$catid.'-'.$r[id].'-'.$modelid; 	$r = get_count($commentid);	if(!$r) exit;    extract($r);} elseif($_GET['module'] && $_GET['id']) {	$module = $_GET['module'];	if((preg_match('/([^a-z0-9_\-]+)/i',$module))) exit('1');	$commentid = $module.'-'.intval($_GET['id']);	$r = get_count($commentid);	if(!$r) exit;    extract($r);    comments($commentid);}/** * 获取点击数量 * @param $hitsid */function get_count($commentid) {	global $db;    $r = $db->get_one(array('commentid'=>$commentid));      if(!$r) return false;		return $r;	}/** * 点击次数统计 * @param $contentid */function comments($commentid) {	global $db;	$r = $db->get_one(array('commentid'=>$commentid));	if(!$r) return false;	$total = $r['total'] + 1;	$sql = array('total'=>$total);    return $db->update($sql, array('total'=>$total));}?>$('#comments').html('<?php echo $total?>');
Copy after login


回复讨论(解决方案)

上面的应该没错,但是最后一句是什么鬼?

一步步来啊,看看输出点啥.同楼上

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template