[英]passing a parameter from view to controller
i'm using Smarty and PHP. 我正在使用Smarty和PHP。
I want to pass some parameter from the view to the controller 我想将一些参数从视图传递到控制器
View 视图
<dd><a href="{site_url()}admin/reloadConditions">Pre Registrado</a></dd>
Controller 控制者
public function reloadConditions($cond){
// some code
}
I want to send for example the parameter "1", and tried different ways of doing like: 我想发送例如参数“ 1”,并尝试了不同的方法,例如:
View 视图
<dd><a href="{site_url()}admin/reloadConditions/1">Pre Registrado</a></dd>
But nothing seems to work. 但是似乎没有任何作用。 Is there any chance to do this?
有机会这样做吗?
Passing argumento get to function: 将参数传递给函数:
url: admin/reloadConditions/1 网址:admin / reloadConditions / 1
function index($id)
{
echo $id; // output 1
}
Guide : http://ellislab.com/codeigniter%20/user-guide/general/controllers.html 指南 : http : //ellislab.com/codeigniter%20/user-guide/general/controllers.html
or 要么
function index()
{
// admin/reloadConditions/1
// admin = 1
// reloadConditions = 2
echo $this->uri->segment(3); // catch third parameter in url
}
Guide : http://ellislab.com/codeigniter%20/user-guide/libraries/uri.html 指南 : http : //ellislab.com/codeigniter%20/user-guide/libraries/uri.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.