php - $_GET does not work in Codeigniter 2.1.3 -
this question has answer here:
- codeigniter php framework - need query string 12 answers
- how can read querystring in codeigniter? 3 answers
i want ref value uri looks http://localhost/project/?ref=6 know $_get['ref'] not work in codeigniter. tried enable setting $config['allow_get_array'] = true; didn't work.
i read on somewhere using $this->input->get('ref') no luck. before using did loaded input library in config.php.
note: want access value in model
added in config.php
$config['uri_protocol'] = "path_info"; $config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-?'; and commented existing $config['uri_protocol'] = 'request_uri'; , $config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-';
controller code is:
parse_str($_server['query_string'], $_get); $ref = $this->security->xss_clean($_get['ref']); log_message('info','>>>>>>>>>>>>>>>>>>enter email_invites method::'.$ref); but still don't value , somehow dont see of log messages.
this line parse url , populate $_get array url's parameters:
parse_str(substr(strrchr($_server['request_uri'], "?"), 1), $_get); it can accessed access array, example:
$ref = $_get['ref']; you config - application/config/config.php - should set follows:
$config['uri_protocol'] = "path_info";
Comments
Post a Comment