我有2个这样的功能
class Infograph extends CI_Controller
{
public function index()
{
$wilayah = $this->input->post('wilayah', TRUE);
$kodeSubWilayah = $this->input->post('subWilayah', TRUE);
if ($kodeSubWilayah) {
$kodeSubWilayah = $this->encryption->decrypt($kodeSubWilayah);
if ($kodeSubWilayah === false) {
redirect('test/404');
}
}
if ($wilayah) {
$data['wilayah'] = strtolower($wilayah);
}
if ($kodeSubWilayah) {
$data['subWilayah'] = $db2->query("SELECT * FROM provinsi WHERE id = ?", [$kodeSubWilayah])->result_array();
}
}
public function export()
{
// i want to send data $data['wilayah'] and $data['subWilayah']
}
}
如何将数据传递到导出功能?我想获取 $data['wilayah'] 和 $data['subWilayah']
使用函数参数
public function export($datawilayah,$datasubWilayah)
在索引函数中调用导出函数,如
$this->export($data['wilayah'],$data['subwilayah'])