문제

in the yii documentation it says:

foreach($_POST['LoginForm'] as $name=>$value)
{
    if($name is a safe attribute)
        $model->$name=$value;
}

what does the array LoginForm come from? which attribute is it coupled to?

도움이 되었습니까?

해결책

In PHP, $_POST contains the input fields 'posted' from an HTML form.

In an HTML form, items have names

Address: <input type='text' name='LoginForm[addr]'>
City: <input type='text' name='LoginForm[city]'>
ST: <input type='text' name='LoginForm[st]'>

So when PHP provides this input to the script it makes the input into an array by the names, which you can iterator over with the foreach.

다른 팁

The $_POST Array? if so that is a reserved/predefined variable, and it contents is usually that of the result of submitted forms. Is this what you are asking?

http://www.php.net/manual/en/reserved.variables.php

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top