자유게시판

제목 allow_get_array 설정값이 생겼네요
글쓴이 작돌이 작성시각 2012/03/07 16:54:58
댓글 : 2 추천 : 0 스크랩 : 0 조회수 : 12513   RSS
1.7 때 작성한 코드를 살펴보다가 팬시URL 사용시 쿼리 스트링이 초기화되는 CI_INPUT 때문에 CI 미워 하고 관심 끊고 있다가 다시 관심 가지고 CI 를 살펴보고 있는 중입니다.

https://github.com/EllisLab/CodeIgniter/blame/develop/application/config/config.php

에서 이력을 보다 보니

allow_get_array 가 추가된 걸 보고 반갑더라구요...

아직 테스트는 못해봤는데 1.7 코드 판올림 작업할 때 확인해봐야겠어요.
예상컨데 URL 혼용해서 사용하는게 가능할 듯해요.

웅파님께서 올려주신 내용에도 언급하신 부분이 있는 걸 보니 확실히 될 듯하네요.

예전 코드는 ...
/*
|--------------------------------------------------------------------------
| Enable Query Strings
|--------------------------------------------------------------------------
|
| By default CodeIgniter uses search-engine friendly segment based URLs:
| example.com/who/what/where/
|
| You can optionally enable standard query string based URLs:
| example.com?who=me&what=something&where=here
|
| Options are: TRUE or FALSE (boolean)
|
| The other items let you set the query string "words" that will
| invoke your controllers and its functions:
| example.com/index.php?c=controller&m=function
|
| Please note that some of the helpers won't work as expected when
| this feature is enabled, since CodeIgniter is designed primarily to
| use segment based URLs.
|
*/
$config['enable_query_strings'] = FALSE;
$config['controller_trigger'] = 'c';
$config['function_trigger'] = 'm';
$config['directory_trigger'] = 'd'; // experimental not currently in use

요즘 코드는 
/*
|--------------------------------------------------------------------------
| Enable Query Strings
|--------------------------------------------------------------------------
|
| By default CodeIgniter uses search-engine friendly segment based URLs:
| example.com/who/what/where/
|
| By default CodeIgniter enables access to the $_GET array. If for some
| reason you would like to disable it, set 'allow_get_array' to FALSE.
|
| You can optionally enable standard query string based URLs:
| example.com?who=me&what=something&where=here
|
| Options are: TRUE or FALSE (boolean)
|
| The other items let you set the query string 'words' that will
| invoke your controllers and its functions:
| example.com/index.php?c=controller&m=function
|
| Please note that some of the helpers won't work as expected when
| this feature is enabled, since CodeIgniter is designed primarily to
| use segment based URLs.
|
*/
$config['allow_get_array'] = TRUE;
$config['enable_query_strings'] = FALSE;
$config['controller_trigger'] = 'c';
$config['function_trigger'] = 'm';
$config['directory_trigger'] = 'd'; // experimental not currently in use

늘어났네요 ㅎㅎ


 
 다음글 CI 중독 (3)
 이전글 복학을 했습니다^^ (4)

댓글

작돌이 / 2012/03/07 17:29:06 / 추천 0
테스트했는데

/index.php/welcome/param?a=1&b=2

이제 이런 패턴도 잘 받네요.

public function param()
{
echo 'param a = ';
echo $this->input->get('a');
echo '<br>param b = ';
echo $this->input->get('b');
echo '<br>all get params : ';
print_r($_GET);
echo '<br>';
echo 'uri 1 : ' . $this->uri->segment(1) . '<br>';
echo 'uri 2 : ' . $this->uri->segment(2) . '<br>';
echo 'uri 3 : ' . $this->uri->segment(3) . '<br>';
echo 'uri 4 : ' . $this->uri->segment(4) . '<br>';
exit;
}




param a = 1
param b = 2
all get params : Array ( [a] => 1 [b] => 2 )
uri 1 : welcome
uri 2 : param
uri 3 :
uri 4 :

나이스'~
이현석 / 2012/03/26 22:03:20 / 추천 0
와우 대박!
아 요거 좋네여 ㅎㅎ
그 동안 삽질 많이 했네 ㅠㅠ