我的观点:
<form action="<?=base_url()?>index.php/frontend/main_con/temp">
<input type="text" name="temp">
<input type="submit"/>
</form>
控制器:
function temp(){
echo $_GET['temp'];
}
我无法达到此功能,但我收到了错误
遇到错误 您提交的URI不允许使用字符。
那么,如何使用GET方法在控制器中传递表单数据? 提前完成。
答案 0 :(得分:8)
查看:
<form action="<?=site_url('controller_name/function_name);?>" method="get">
<input type="text" name="temp">
<input type="submit"/>
</form>
控制器
class controller_name extends CI_Controller{
function function_name(){
echo $this->input->get('temp');
}
}
答案 1 :(得分:2)
parse_str($_SERVER['QUERY_STRING'],$_GET);
在我将以下行添加到applications / config / config.php之后,仅对我有用:
$config['uri_protocol'] = "PATH_INFO";
答案 2 :(得分:1)
要解决错误,请转到this line。我个人认为,这是设计上的错误,因为来自URI的黑名单符号会比白名单更好。
对于GET
变量..您必须使用<form method="get" action="/what/ever/">
。
答案 3 :(得分:1)