codeigniter - php 新手 问题
程序员文章站
2022-06-14 22:56:32
...
model
class Stock_model extends CI_Model{
private $hsh;
function __construct()
{
parent::__construct();
$_ci = & get_instance();
//$this->hsh = $_ci->load->database('hsh',TRUE);
$hsh = $_ci->load->database('hsh',TRUE);
}
function get_stock($goods_huo)
{
if(isset($goods_huo))
{
$hsh->where('item_huo',$goods_huo);
$query = $hsh->get('item_info');
return $query->result_array();
$query->free_result();
}
}
}
报错
A PHP Error was encountered
Severity: Notice
Message: Undefined variable: hsh
Filename: models/stock_model.php
Line Number: 22