0
Codeigniter를 동적 하위 도메인과 함께 사용하고 있지만 컨트롤러의 각 메소드에서 동적 하위 도메인의 계정을 가져와야합니다. 내가 좋아하는 모든 방법 도메인을 얻고 그것없이 $ 데이터에 추가 할 수있는 방법을 찾고 있어요 :Codeigniter 하위 도메인 와일드 카드가 모든 방법으로 계정 가져 오기
<?php
class Dashboard extends CI_Controller {
function index()
{
$subdomain_arr = explode('.', $_SERVER['HTTP_HOST'], 2);
$subdomain_name = $subdomain_arr[0];
$this->db->from('accounts')->where('subdomain', $subdomain_name);
$query = $this->db->get();
$account = $query->row();
$data['account_id'] = $account->id;
$data['account_name'] = $account->name;
$this->load->view('index', $data);
}
function clients()
{
$subdomain_arr = explode('.', $_SERVER['HTTP_HOST'], 2);
$subdomain_name = $subdomain_arr[0];
$this->db->from('accounts')->where('subdomain', $subdomain_name);
$query = $this->db->get();
$account = $query->row();
$data['account_id'] = $account->id;
$data['account_name'] = $account->name;
$this->load->view('clients', $data);
}
}
내 사용자 정의 컨트롤러를 만들고 내 컨트롤러에서 모두 확장하여 계정 데이터를 가져 오는 생성자 메서드를 숨길 수있는 방법이 있습니까? – cristianormoraes
@cristianormoraes, 귀하의 의견 문법이나 말씨를 이해하지 못합니다. – Sparky