我知道這個問題已經有了答案,但是我不明白,所以再次詢問所以請大家幫忙。
這個錯誤實際上是什麼意思?
Fatal error: Using $this when not in object context in C:\wamp\www\provisioning\application\controllers\customer\provisioning.php on line 27
public function index(){
$users = $this->data['tenant_users'] = $this->customer_user_m->tenant_users();
$domain = $users[0]['domain'];
$site = $users[0]['site_key'];
$tenant_id = $users[0]['tenant_id'];
$site = $this->session->userdata('site');
$user_table = $this->session->userdata('user_table');
function getOTAURLExt($ext){
var_dump($this);
}
function getOTAURLSite(){
echo "Site executed";
}
$this->db->select('*');
$this->db->where('id', $tenant_id);
$this->db->from('tenant');
$query = $this->db->get();
$result = $query->result_array();
if(empty($this->input->post('md'))){
$URL = getOTAURLSite($site);
}else{
$username = $result[0]['username'];
$table_user = $username . "_users";
$this->db->select('*');
$this->db->where($table_user . '.site_key', $site);
$this->db->join('mlcsites', 'mlcsites.site_key =' . $table_user . '.site_key');
$this->db->from($table_user);
$query_table = $this->db->get();
$information = $query_table->result_array();
$ext = $information[0]['ext'];
$count = count($information);
$found = false;
for($i = 0; $i < $count; $i++){
$domain = $information[$i]['domain'];
$ext = $information[$i]['ext'];
$hash = do_hash($ext . "@" . $domain, 'md5');
if($hash == $this->input->post('md')){
$found = true;
break;
}
}
if($found == true){
$URL = getOTAURLExt($ext);
}
}
if(empty($URL)){
}
$this->data['subview'] = 'provisioning/index';
$this->load->view('_layout_main', $this->data);
}
可能是什麼可能的解決方案呢?
'$ users = $ this-> data''tenant_users'] = $ this-> customer_user_m-> tenant_users();'multi assign !! –
codeing for line 27在provisioning.php中? – itzmukeshy7
@DavidJawphan忽略它,它應該是這樣$ this-> data ['tenant_users'] = $ this-> customer_user_m-> tenant_users();'所以我會通過tenant_users數組來查看 – Rajan