Laravel 4 Laravel 4输入::仅限通配符
有没有办法在Input::only中使用通配符 例如:Laravel 4 Laravel 4输入::仅限通配符,laravel-4,Laravel 4,有没有办法在Input::only中使用通配符 例如: $actInputs = Input::only('act*'); 只给我以字符串开头的输入act这有效: $actInputs = array(); foreach (Input::all() as $id => $value) { if (preg_match('/^act(\w+)/i', $id)) $actInputs[$id] = $value; } 这项工作: $actInputs = array(
$actInputs = Input::only('act*');
只给我以字符串开头的输入act
这有效:
$actInputs = array();
foreach (Input::all() as $id => $value) {
if (preg_match('/^act(\w+)/i', $id))
$actInputs[$id] = $value;
}
这项工作:
$actInputs = array();
foreach (Input::all() as $id => $value) {
if (preg_match('/^act(\w+)/i', $id))
$actInputs[$id] = $value;
}
我想到了另一种方法
(InputStartWith、InputEndWith和InputMatching)
像这样使用它:
$inputs = inputStartsWith('act');
$inputs = inputEndsWith('_name');
// will match 'first_name1' and 'first_name2' (ends with digit)
$inputs = InputMatching("/^.*\d$/");
更新:(也inputedswith
)
像这样使用它:
$inputs = inputStartsWith('act');
$inputs = inputEndsWith('_name');
// will match 'first_name1' and 'first_name2' (ends with digit)
$inputs = InputMatching("/^.*\d$/");
可以将它们用作助手
函数,或者扩展核心
类并添加这些函数
更新:(模式匹配)
像这样使用它:
$inputs = inputStartsWith('act');
$inputs = inputEndsWith('_name');
// will match 'first_name1' and 'first_name2' (ends with digit)
$inputs = InputMatching("/^.*\d$/");
我想到了另一种方法
(InputStartWith、InputEndWith和InputMatching)
像这样使用它:
$inputs = inputStartsWith('act');
$inputs = inputEndsWith('_name');
// will match 'first_name1' and 'first_name2' (ends with digit)
$inputs = InputMatching("/^.*\d$/");
更新:(也inputedswith
)
像这样使用它:
$inputs = inputStartsWith('act');
$inputs = inputEndsWith('_name');
// will match 'first_name1' and 'first_name2' (ends with digit)
$inputs = InputMatching("/^.*\d$/");
可以将它们用作助手
函数,或者扩展核心
类并添加这些函数
更新:(模式匹配)
像这样使用它:
$inputs = inputStartsWith('act');
$inputs = inputEndsWith('_name');
// will match 'first_name1' and 'first_name2' (ends with digit)
$inputs = InputMatching("/^.*\d$/");
使用此代码时,您会得到什么?当我var\u转储它时,它在浏览器中返回null。使用此代码时,您会得到什么?当我var\u转储它时,它在浏览器中返回null