代码点火器功能未显示? helper.website.php view.header.php
它显示一个空白页,没有错误,什么都没有 它显示一个空白页,因为您没有向视图文件传递任何数据。要获取视图文件中的数据,必须从控制器加载包含一些数据的视图。语法是-代码点火器功能未显示? helper.website.php view.header.php,php,codeigniter,pdo,Php,Codeigniter,Pdo,它显示一个空白页,没有错误,什么都没有 它显示一个空白页,因为您没有向视图文件传递任何数据。要获取视图文件中的数据,必须从控制器加载包含一些数据的视图。语法是- <?php class Your_Controller_Class extends CI_Controller { function your_function() { $data['data'] = 'Your data'; //get it from your model or whatever
<?php
class Your_Controller_Class extends CI_Controller {
function your_function()
{
$data['data'] = 'Your data'; //get it from your model or whatever
$this->load->view('your_view_file', $data);
}
}
?>
然后从视图文件访问它。helper.website.php
public function getOnlineCount(){
$this->load->lib(array('rank_db', 'db'), array(HOST, USER, PASS, CHARACTERS));
return $this->registry->rank_db->snumrows('SELECT count(name) as count from users where status <> -1 AND sub_status>= 1');
}
公共函数getOnlineCount(){
$this->load->lib(数组('rank_db','db')、数组(主机、用户、过程、字符));
返回$this->registry->rank_db->snumrows('SELECT count(name)as count from users,其中status-1和sub_status>=1');
}
在view.header.php
中工作得非常完美!如何将其转换为我的查询使用错误报告打开。已打开,但什么也没有发生!你能试着键入$rank并告诉结果是什么吗?我知道问题出在view.header.php,因为如果我用缺少的表编辑查询,那么对于初学者来说,我看不到你在helper.website.php和view.header.php中显示的内容之间有任何关系。使用$rank=load::get('website');load::get()定义在哪里?是否可以将该函数更改为我在第一个问题中的函数?$top=load::get('website')->top_players();这就是解决办法!
<?php
class Your_Controller_Class extends CI_Controller {
function your_function()
{
$data['data'] = 'Your data'; //get it from your model or whatever
$this->load->view('your_view_file', $data);
}
}
?>
public function getOnlineCount(){
$this->load->lib(array('rank_db', 'db'), array(HOST, USER, PASS, CHARACTERS));
return $this->registry->rank_db->snumrows('SELECT count(name) as count from users where status <> -1 AND sub_status>= 1');
}