Laravel 5.2 数组到字符串转换错误
Laravel 5.2 Array to string conversion error
我正在使用 Laravel 5.2 进行一个项目,并且正在制作一个简单的表格,但我收到错误消息:
数组到字符串的转换(查看:C:\xampp\htdocs\projects\codehacking\resources\views\admin\posts\create.blade.php)
这是我的代码:
@extends('layouts.admin')
@section('content')
<h1>Create Post</h1>
{!! Form::open(['method'=>'POST', 'action'=>'AdminPostsController@store', 'files'=>true]) !!}
<div class="form-group">
{!! Form::label('title', 'Title:') !!}
{!! Form::text('title', null, ['class'=>'form-control'])!!}
</div>
<div class="form-group">
{!! Form::label('category_id', 'Category:') !!}
{!! Form::select('category_id', array(''=> 'options'), null, ['class'=>'form-control'])!!}
</div>
<div class="form-group">
{!! Form::label('photo_id', 'Photo:') !!}
{!! Form::file('photo_id', ['class'=>'form-control'])!!}
</div>
<div class="form-group">
{!! Form::label('body', 'Description:') !!}
{!! Form::textarea('body', ['class'=>'form-control'])!!}
</div>
<div class="form-group">
{!! Form::submit('Create Post', ['class'=>'btn btn-primary'])!!}
</div>
{!! Form::close() !!}
@停止
我认为错误可能出在 select 元素上,因为我在该元素中创建了一个带有选项的数组,但即使我删除了该元素,我也遇到了同样的错误。
不确定我做错了什么?
你的错误在textarea上
{!! Form::textarea('body', null, ['class'=>'form-control'])!!}
我正在使用 Laravel 5.2 进行一个项目,并且正在制作一个简单的表格,但我收到错误消息:
数组到字符串的转换(查看:C:\xampp\htdocs\projects\codehacking\resources\views\admin\posts\create.blade.php)
这是我的代码:
@extends('layouts.admin')
@section('content')
<h1>Create Post</h1>
{!! Form::open(['method'=>'POST', 'action'=>'AdminPostsController@store', 'files'=>true]) !!}
<div class="form-group">
{!! Form::label('title', 'Title:') !!}
{!! Form::text('title', null, ['class'=>'form-control'])!!}
</div>
<div class="form-group">
{!! Form::label('category_id', 'Category:') !!}
{!! Form::select('category_id', array(''=> 'options'), null, ['class'=>'form-control'])!!}
</div>
<div class="form-group">
{!! Form::label('photo_id', 'Photo:') !!}
{!! Form::file('photo_id', ['class'=>'form-control'])!!}
</div>
<div class="form-group">
{!! Form::label('body', 'Description:') !!}
{!! Form::textarea('body', ['class'=>'form-control'])!!}
</div>
<div class="form-group">
{!! Form::submit('Create Post', ['class'=>'btn btn-primary'])!!}
</div>
{!! Form::close() !!}
@停止
我认为错误可能出在 select 元素上,因为我在该元素中创建了一个带有选项的数组,但即使我删除了该元素,我也遇到了同样的错误。 不确定我做错了什么?
你的错误在textarea上
{!! Form::textarea('body', null, ['class'=>'form-control'])!!}