+ -
当前位置:首页 → 问答吧 → CodeIgniter超链接传递参数

CodeIgniter超链接传递参数

时间:2011-04-15

来源:互联网

CodeIgniter框架中,超链接如何传递参数,以及获得这个参数?
?????

作者: ematphp   发布时间: 2011-04-15

默认情况下是这样传递的:
http://localhost/index.php/controllerName/methodName/parameter1/parameter2

对应的controller.php
PHP code

class controllerName extends controller{
  //methods.....
  public function methodName($paremeter1,parameter2){
    
  }
}

作者: hahaliu005   发布时间: 2011-04-15

PHP code

print_r($this->uri->segment_array());




作者: TottyAndBaty   发布时间: 2011-04-15

开启配置文件中的$config['enable_query_strings'] = TRUE;

此时可以用GET方式传递参数:

http://localhost/index.php?c=controllerName&m=methodName&para1=xxx&para2=xxx;

然后在服务器端接收即可。

作者: whg4585   发布时间: 2011-04-15