CI : ใช้ Query String กับ CodeIgniter by plug.in

12
May
0

Refer : http://www.askaboutphp.com/tutorials/58/codeigniter-mixing-segment-based-url-with-querystrings.html

Codeigniter ตามปกติจะไม่สามารถใช้งาน URL โดยมีตัวแปน GET (Query String) ได้

หากต้องการให้ใช้งานได้มีสองวิธี

1. Global

ตั้งค่าใน Config.php ตามนี้
$config['uri_protocol'] = “PATH_INFO”; $config['enable_query_strings'] = TRUE;

2. Local

แบบ global จะมีปัญหาเล็กน้อยเรื่องตัวแปรชื่อ c , m , d ซึ่งเป็น default สำหรับเรียก controller เมื่อ

แบบ local จะตั้งค่าใน Config.php ตามนี้$config['enable_query_strings'] = FALSE; $config['uri_protocol'] = “PATH_INFO”;

และใน Controller Initialize ให้แทรกบรรทัดนี้

Share

Enjoy this article?

Consider subscribing to our RSS feed!

No Comments

No comments yet.

Leave a comment

RSS feed for comments on this post