[英]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'])!!}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.