如何将post变量传递给segment url?我可以从网址读取它,但我无法设置它...
我到目前为止:路由上的$route['shop/find/(:any)']= "shop/find/$1";
,视图上的find.php和我的函数`
function find()
{
$this->load->model('shopFront/find');
$this->load->model('currency');
$this->load->model('shopFront/calculate');
$this->load->model('shop/proccess');
$data = $this->commondatashop->general();
$inputSlug = $this->input->post('findSlug');
$data['tofind'] = $inputSlug;
$data['cartInfo'] = $this->shopcart;
$data['Currency'] = $this->currency;
$data['Calculate'] = $this->calculate;
$data['Proccess'] = $this->proccess;
$data['title'] = "1.4.U Shop | Find";
$finder = $this->find;
$data['finderservice'] = $finder;
$data['user_id'] = $this->session->userdata('user_id');
$data['user_name'] = $this->session->userdata('user_name');
$this->load->view('shop/top/topNew',$data);
$this->load->view('shop/content/find',$data);
//footer
$curravailable = $this->calculate->getCurrencies();
if ( $curravailable !== false )
{
$data['currencies'] = $curravailable;
}
else
{
$data['currencies'] = 'none';
}
$this->load->view('shop/footer',$data);
}`
如何使用url段将变量发布到find()函数?
答案 0 :(得分:0)
您需要找到接受默认
的参数function find($i=0) {
//$i is whatever is in the URL or defaults to 0
答案 1 :(得分:0)
在您看来:
echo form_open('/shop/find');
echo form_input('findSlug','');
echo form_submit('submit', 'Submit');
echo form_close();
控制器:
$data[slug] = $this->input->post('findSlug');
您还需要加载表单助手