php 환경은 xampp 로 개발하고 있습니다.

php.ini 설정 값입니다.

register_globals=Off
register_long_arrays=Off
magic_quotes_gpc=Off
magic_quotes_runtime=Off
magic_quotes_sybase=Off
 

a.html

<form name="test" method="post">
<input type="hidden" name="index_srl[]" value="1">
<input type="hidden" name="index_srl[]" value="2">
<input type="hidden" name="index_title[]" value="a">
<input type="hidden" name="index_title[]" value="b">
<input type="hidden" name="mid" value="testmid">
<input type="hidden" name="act" value="dispTestTest">
</form>
<script>
var document.test.submit();
</script>

 

 

test.view.php

function dispTestTest()
{
$args = Context::getRequestVars();
Context::set('info_list',$args);
$this->setTemplateFile('test_act');
}

 

 

test_act.html

<block loop="$i=0;$i<count($index_title);$i++">
<p>{$index_title[$i]}</p>
</block>

 

결과

a

b

 

test.view.php 를 보시면..

Context::set("index_title",$args->index_title); 을 추가 한적이 없습니다.

XE 에서 이렇게 출력이 되는것인가요?

 

  • profile

    form으로 전송한 변수는 자동으로 Context에 추가됩니다.

    편리한 기능이면서도 잘못 사용하면 위험할 수 있어요. 필터링되지 않은 변수를 그대로 출력한다든지...

    아마 XE가 처음 만들어질 당시에는 register_globals를 많이 썼기 때문에

    기존 개발자들의 편의를 위해 저렇게 설계한 것 같네요.

  • profile profile

    xe 자체에서 넘어온 $_POST나 $_GET을 자동으로 Context 로 추가 하는군요.
    오류 인줄 알고 살짝 놀랐습니다.
    감사합니다.