Home > Codeigniter, PHP > Codeigniter Framework lấy dữ liệu dạng get (url)

Codeigniter Framework lấy dữ liệu dạng get (url)

 

Codeigniter framework lấy dự liệu dạng get

Ví dụ:
Ta có url = http://www.noithatdatviet.vn/test.php?r=234&p=10 

Code:

$url = parse_url($_SERVER[‘REQUEST_URI’]);
parse_str($url[‘query’], $params);
print_r($params[‘r’]) //output 234
print_r($params[‘p’]) //output 10

 

Advertisements
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: