컨트롤러에서 글로벌 변수는CodeIgniter는 : 나는 CodeIgniter의에 아주 안돼서, 나는 내가 갈 동안, 절차 코딩, 쉽게 고칠 수 있었다 문제에 실행
현재의 문제는 : 내가 가진 내가하지 않은 있도록
$data['title'] = 'Page Title';
$data['robots'] = 'noindex,nofollow';
$data['css'] = $this->config->item('css');
컨트롤러에 그들이 "글로벌"할 수있는 방법이 아닌가 : 당신이 볼 수 있듯이이 컨트롤러
class Basic extends Controller {
function index(){
$data['title'] = 'Page Title';
$data['robots'] = 'noindex,nofollow';
$data['css'] = $this->config->item('css');
$data['my_data'] = 'Some chunk of text';
$this->load->view('basic_view', $data);
}
function form(){
$data['title'] = 'Page Title';
$data['robots'] = 'noindex,nofollow';
$data['css'] = $this->config->item('css');
$data['my_other_data'] = 'Another chunk of text';
$this->load->view('form_view', $data);
}
}
, 일부 배열 항목은 반복 반복 eac에 입력하려면 h 기능? 같은 뭔가 (그러나 이것은 나에게 오류를 제공) : 사전에
class Basic extends Controller {
// "global" items in the $data array
$data['title'] = 'Page Title';
$data['robots'] = 'noindex,nofollow';
$data['css'] = $this->config->item('css');
function index(){
$data['my_data'] = 'Some chunk of text';
$this->load->view('basic_view', $data);
}
function form(){
$data['my_other_data'] = 'Another chunk of text';
$this->load->view('form_view', $data);
}
}
Thnaks!
@Dalen : 오타를 수정 해 주셔서 감사합니다 .-) –
당신을 환영합니다! – Dalen
감사합니다! 한편, "$ this-> load-> vars ($ array)"가 제 예제에 정말 적합하다는 것을 알았 기 때문에 질문을 잊어 버렸습니다. 어쨌든 제공된 배열은 배열과 배열 사이에 배열을 전달해야합니다. 클래스 메소드 – Ivan