【发布时间】:2015-12-15 21:38:39
【问题描述】:
你好我想问从url获取值参数到我的控制器
我像这样从 javascript 设置重定向 url,
window.location.href = '<?php echo base_url().'index.php/form_tambahasset'?>' + '?lang=' + lg + '&lat=' +lt;
我需要将参数lang 和lat 带到我的下一页,
http://localhost/BTS_CI/index.php/form_tambahasset
如果我将重定向网址设置为这样,
http://localhost/BTS_CI/index.php/form_tambahasset/lang/107.39410400390625/lat/-6.671700384923497
一定是404页面未找到。
如何获取值参数 lang 和 lat ?我现在在REQUEST_URI 的$config['uri_protocol'] 的位置,但我尝试更改为PATH_INFO,它对我不起作用。
我尝试$this->uri->segment(3, 0); 和parse_str($_GET['lat'], $_GET); 仍然无法获取我的参数。
我的页面
http://localhost/BTS_CI/index.php/form_tambahasset?lang=107.39410400390625&lat=-6.671700384923497
做得很好,但我需要获取我的参数值
我的问题有什么解决方案吗?请帮我。谢谢
【问题讨论】:
-
只是小费;使用
site_url而不是base_url,请使用以下格式:site_url('index.php/form_tambahasset')。
标签: php codeigniter uri codeigniter-3 request-uri