如何解决遇到codeigniter3的PHP错误

why i can't access it?

my model
News_model.php :

        <?php 
        class News_model extends CI_Model
        {

          public function __construct()
          {
            $this->load->database();
          }

          public function get_news(){
            $query = $this->db->get['news'];
            return $query->result_array();
          }

        }

        ?>  

    my Controller
    news.php :

        <?php
    defined('BASEPATH') OR exit('No direct script access allowed');

    class News extends CI_Controller {

      public function __construct (){
        parent::__construct();
        $this->load->model('news_model');
        $this->load->helper('url_helper');
      }

      public function index()
      {
        $data['news'] = $this->news_model->get_news();  
        $data['title'] = 'arsip';
        $this->load->view('news/index', $data);
      }
    }
    ?>
my view
news/index.php

<?php
foreach ($news as $news_item) { ?>
  <h1><?php echo $news_item['title']; ?> </h1>
  //  <p><?php echo $news_item['text']; ?> </p>
<? } ?>

?>

routes :
<?php
defined('BASEPATH') OR exit('No direct script access allowed');

$route['news'] = 'news';
$route['default_controller'] = 'halaman/view';

$route['(:any)'] = 'halaman/view/$1';

$route['404_override'] = '';
$route['translate_uri_dashes'] = FALSE;

and then acces http://localhost/codeigniter/index.php/news the output is :

A PHP Error was encountered

Severity: Notice

Message: Undefined property: CI_DB_mysqli_driver::$get

Filename: models/News_model.php

Line Number: 11

Backtrace:

File: /opt/lampp/htdocs/codeigniter/application/models/News_model.php Line: 11 Function: _error_handler

File: /opt/lampp/htdocs/codeigniter/application/controllers/News.php Line: 14 Function: get_news

File: /opt/lampp/htdocs/codeigniter/index.php Line: 315 Function: require_once

Fatal error: Call to a member function result_array() on null in /opt/lampp/htdocs/codeigniter/application/models/News_model.php on line 12 A PHP Error was encountered

Severity: Error

Message: Call to a member function result_array() on null

Filename: models/News_model.php

change Your $this->db->get();

It's should not be array notation

  $this->db->get['news'];

it should be like

 $this->db->get('news');

alternatively u can use

  $this->db->select('*');
  $this->db->from('news');

  $query = $this->db->get();
  return $query->result_array()

You have to give the table name like this:-

public function get_news(){
    $query = $this->db->get('news');
    return $query->result_array();
}

Refer this link http://www.codeigniter.com/user_guide/database/examples.html#query-builder-query