欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  后端开发

laravel怎么接收和保存一组checkbox到数据库?

程序员文章站 2023-12-21 23:32:10
...
正在使用的是Laravel 5.2,我知道怎么接收text,email, select, radio, textarea等,并把它们保存到数据库,但是不知道怎么接收和保存一组checkbox到数据库。
比如下面这个例子:

        {!! Form::open(array('url' => 'foo/bar')) !!}
    
      
We'll never share your email with anyone else.
This is some placeholder block-level help text for the above input. It's a bit lighter and easily wraps to a new line.
{!! Form::close() !!}

回复内容:

正在使用的是Laravel 5.2,我知道怎么接收text,email, select, radio, textarea等,并把它们保存到数据库,但是不知道怎么接收和保存一组checkbox到数据库。
比如下面这个例子:


        {!! Form::open(array('url' => 'foo/bar')) !!}
    
      
We'll never share your email with anyone else.
This is some placeholder block-level help text for the above input. It's a bit lighter and easily wraps to a new line.
{!! Form::close() !!}

使用name=check[ ]
这样接收的就是一个数组

相关标签: laravel php

上一篇:

下一篇: