phpcms v9 기사 클릭은 hits 테이블
의views 필드에 있는 테이블과 필드phpcms v9 기사 클릭이 있습니다.
자세한 설명:
클릭수를 가져오는 인스턴스
{pc:content action="lists" catid="$catid" num="25" order="id DESC" page="$page" moreinfo="1"} {loop $data $r} {php $db = pc_base::load_model('hits_model'); $_r = $db->get_one(array('hitsid'=>'c-'.$modelid.'-'.$r[id])); $views = $_r[views]; } {php $comment_tag = pc_base::load_app_class("comment_tag", "comment"); $comment_total = $comment_tag->count(array('commentid'=>'content_'.$catid.'-'.$r[id].'-'.$modelid));} <li><span class="rt">{date('Y-m-d H:i:s',$r[inputtime])}</span>·<a href="{$r[url]}" target="_blank"{title_style($r[style])}>{$r[title]}</a> 点击:{$views} 评论数:{if $comment_total}{$comment_total}{else}0{/if}</li>{/loop} {$pages} {/pc}
세 번째 줄은 클릭수를 가져오는 것입니다.
$db = pc_base::load_model('hits_model')
인스턴스화 개체는 $db, 인스턴스화 클래스인 hit_model을 로드합니다. 이 위치는 클래스는 루트 디렉토리에 있습니다 phpcmsmodelhit_model .class.php 파일에서
class hits_model extends model { public $table_name = ''; public function __construct() { $this->db_config = pc_base::load_config('database'); $this->db_setting = 'default'; $this->table_name = 'hits'; parent::__construct(); } }
이 클래스 파일은 모델 클래스 파일을 로드 및 상속하고 내부 메소드를 상속하므로 get_one() 메소드가 아래에서 호출됩니다
$_r = $db- >get_one(array('hitsid' =>'c-'.$modelid.'-'.$r[id])) $db 객체에서 get_one 메소드를 호출합니다. 이 메소드는 상속된 모델 클래스에 있습니다. by Hits_model. 코드는 다음과 같습니다
final public function get_one($where = '', $data = '*', $order = '', $group = '') { if (is_array($where)) $where = $this->sqls($where); return $this->db->get_one($data, $this->table_name, $where, $order, $group); }
get_one(arr('hitsid '=>'c-'.$modelid.'-'.$r[id])) 메소드에 전달된 배열은 데이터 테이블 v9_hits의 필드는 다음과 같습니다.
$_r[views] 클릭수를 알아보세요!
위 내용은 phpcms v9 기사에 대한 클릭 수는 어떤 테이블과 필드입니까?의 상세 내용입니다. 자세한 내용은 PHP 중국어 웹사이트의 기타 관련 기사를 참조하세요!