如何將數據從控制器傳遞到CodeIgniter中的視圖?如何將Controller中的數據傳遞給CodeIgniter中的View?
控制器
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Hello extends CI_Controller {
public function index()
{
$data['hello']= "helloooo";
$this->load->view('hello_world');
}
}
請使用谷歌在控制器笨... –
https://www.codeigniter.com/user_guide/general/views.html#adding-dynamic-data-to-the-view – user4419336
的閱讀文檔'$ this-> load-> view('hello_world',$ data);'在視圖中'echo $ hello' –