我尝试将 highcharts 库添加到我的 CI 项目中。所以我在我的控制器中尝试了 db query<?phpdefined('BASEPATH') OR exit('No direct script access allowed');class ChartController extends CI_Controller { public function __construct() { parent::__construct(); $this->load->database(); } public function index() { $query = $this->db->query("SELECT SUM(numberofclick) as count FROM demo_click GROUP BY YEAR(created_at) ORDER BY created_at"); $data['click'] = json_encode(array_column($query->result(), 'count'),JSON_NUMERIC_CHECK); $query = $this->db->query("SELECT SUM(numberofview) as count FROM demo_viewer GROUP BY YEAR(created_at) ORDER BY created_at"); $data['viewer'] = json_encode(array_column($query->result(), 'count'),JSON_NUMERIC_CHECK); $this->load->view('my_chart', $data); }}然后我尝试通过视图访问。我放置了以下代码来检查控制器的输出。<?php echo var_dump($this->_ci_cached_vars);?>然后我得到,以下输出没有值。这是什么问题?array (size=2) 'click' => string '[]' (length=2) 'viewer' => string '[]' (length=2)
1 回答
- 1 回答
- 0 关注
- 119 浏览
添加回答
举报
0/150
提交
取消