Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I've been searching the web for how to get POST data inside the controller, so far I have found two solutions: Input::get() and $_POST.

The comment for Input::get() reads:

/**
 * Gets a "parameter" value.
 *
 * This method is mainly useful for libraries that want to provide some flexibility.
 *
 * Order of precedence: GET, PATH, POST
 *
 * Avoid using this method in controllers:
 *
 *  * slow
 *  * prefer to get from a "named" source
 *
 * It is better to explicitly get request parameters from the appropriate
 * public property instead (query, attributes, request).
 *
 * @param string  $key     the key
 * @param mixed   $default the default value
 * @param Boolean $deep    is parameter deep in multidimensional array
 *
 * @return mixed
 */

What is this "named" source they refer to? What is it I should use instead of Input::get() ?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
274 views
Welcome To Ask or Share your Answers For Others

1 Answer

The documentation shows you can retrieve an input value for any HTTP verb by using Input::get().

$name = Input::get('name');

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...