1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- <?php
- namespace Content\Lib;
- use Dever;
- class Article
- {
- # 根据文章id 获取文章信息
- public function get($data)
- {
- if (!is_array($data)) {
- $data = Dever::db('content/article')->getOne($data);
- }
-
- if (!$data) {
- Dever::alert('错误的文章信息');
- }
-
- //embed
- $data['content_array'] = array();
- if (strstr($data['content'], 'embed')) {
- //print_r($data['content']);die;
- preg_match_all('/<embed src="(.*?)"(.*?)\/>/i', $data['content'], $matches);
- if (isset($matches[1])) {
- foreach ($matches[1] as $k => $v) {
- }
- }
- //print_r($matches);die;
- }
-
- return $data;
- }
- # 获取相关推荐
- public function getRelation($info)
- {
- $where['noid'] = $info['id'];
- $where['cate_id'] = $info['cate_id'];
- return Dever::db('content/article')->getRelation($where);
- }
- # 增加浏览量
- public function addView($id)
- {
- Dever::db('content/article')->addView($id);
- }
- }
|