$ _SESSION変数に基づいて、私のCodeIgniterモデルのテーブル名を変更したいと思います。変数は言語を決定し、選択した言語に応じて別のテーブルを照会したい。セッション変数に基づいてCodeIgnitorモデルのテーブル名を決定する方法
は、今のところ私はこれ持っている:
<?php if (!defined('BASEPATH')) exit ('No direct script access allowed');
class Tp_modules_model extends DataMapper {
public function __construct(){
parent::__construct();
}
public $table = determineTable($_SESSION['lang']);
public function getModules($ids) {
$this->clear();
return $this->where_in('id', $ids)->get()->all_to_array();
}
public function determineTable($lang) {
if ($lang == 'nl') {
return 'modules_dutch';
} else {
return 'modules';
}
}
}
を私は、このエラーメッセージが出ます:
Parse error: syntax error, unexpected '(', expecting ',' or ';' in /usr/www/users/staginntkx/application/modules/ecom_bookings/models/tp_modules_model.php on line 9
を、このための回避策または出力に基づいて、私のモデルのテーブルを変更するための別の方法はあります$ _SESSION ['lang']のですか?どんな助けも素晴らしいでしょう、ありがとう!