首页 > 解决方案 > 从codeigniter中的另一个函数获取变量

问题描述

我想问一下如何从其他函数中但仍在同一个控制器中的变量中获取数据....

这是函数,其中将发送名为 $whs 的变量

function deliver($whs_id)
{
  $whs = $whs_id; // here is variable to pass

  $this->cart->destroy();
  $this->template->set_title('Package');
  $this->breadcrumbs->push('Package', '/Package');
  $this->breadcrumbs->push('Create Package', '/pacakge/index');


 $data['item'] = $this->MY_Model->join2_where('box_stock','product_code','box_product','product_code','whs_id',$whs_id)->result();
 $this->template->load('templates/Template', $this->folder.'/item', $data);

}

function save()
{
    $whs2 =$whs; // i will get data in here

        // judul halaman
  $this->template->set_title('Package');
        // Breadcrumbs
  $this->breadcrumbs->push('Package', 'package');
  $this->breadcrumbs->push('Save', '/package/save');
        // JS Init
  $js_init =  "";


  }

如何获取同一控制器中另一个函数中的数据?

标签: phpcodeigniter-3

解决方案


推荐阅读