[英]IF condition to show specific data to the logged in user
我需要將特定用戶的視圖從系統分離到特定客戶端。 例如; 登錄的用戶(用戶1-ID_1)只能查看客戶端數據(客戶端2-ID_2)。 是否可以在IF條件下執行以下示例中的操作? (Id_users來自users表,id_clients來自clients表)
public function view() {
if ($this-> 'id_users' = '1') {
data['view'] = 'idclients' = '2';
}
$this->data['custom_error'] = '';
$this->load->model('mapos_model');
$this->data['result'] = $this->os_model->getById($this->uri->segment(3));
$this->data['products'] = $this->os_model->getProducts($this->uri->segment(3));
$this->data['services'] = $this->os_model->getServices($this->uri->segment(3));
$this->data['emitent'] = $this->mapos_model->getEmitent();
$this->data['view'] = 'os/viewOs';
$this->load->view('theme/top', $this->data);
}
您可以在項目的任何地方使用會話
if($this->session->userdata('session_name')){
echo "Your specific data";
}
else{
echo "Others Data";
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.