有html和窗体外观的问题

时间:2015-07-02 13:49:40

标签: php html laravel-5

问题是表单和html功能是使用标记的ASCI值返回的。

{{ Form::open(['method' => 'delete']) }}
<a href="{{ url('cats/'.$cat->id.'/delete')}}">
  <span class="glyphicon glyphicon-trash"></span>
  Delete
</a>
{{ Form::close() }}

结果是:

&lt;form method=&quot;POST&quot; action=&quot;http://localhost/firstApp/public/cats/1&quot; accept-charset=&quot;UTF-8&quot;&gt;&lt;input name=&quot;_method&quot; type=&quot;hidden&quot; value=&quot;DELETE&quot;&gt;&lt;input name=&quot;_token&quot; type=&quot;hidden&quot; value=&quot;kRqLd1lCbS9qNkH7DX4cZbctUHzbpqONP4FwsSis&quot;&gt;
<a href="http://localhost/firstApp/public/cats/1/delete">
  <span class="glyphicon glyphicon-trash"></span>
  Delete
</a>
&lt;/form&gt;

我也遇到了与link_to函数相同的问题。我不知道刀片模板引擎可能存在问题吗?

另外我想问一下是否有办法使用链接不是表格的删除路由器?

1 个答案:

答案 0 :(得分:3)

这不是问题,默认情况下,刀片{{ }}会转义输出。

如果您不想逃避输出,请执行{!! !!}

{!! Form::open(['method' => 'delete']) !!}
<a href="{!! url('cats/'.$cat->id.'/delete') !!}">
  <span class="glyphicon glyphicon-trash"></span>
  Delete
</a>
{!! Form::close() !!}