laravel 找不到类“HTML”(视图:C:\xampp\htdocs\laravel_demo\resources\views\pages\registration.blade.php)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/41295554/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Class 'HTML' not found (View: C:\xampp\htdocs\laravel_demo\resources\views\pages\registration.blade.php)
提问by Shanu k k
I am beginner in laravel 5.3 and i have added href link to my html form it's get an error like
我是 laravel 5.3 的初学者,我已经在我的 html 表单中添加了 href 链接,它出现了类似的错误
Class 'HTML' not found (View: C:\xampp\htdocs\laravel_demo\resources\views\pages\registration.blade.php)
找不到类“HTML”(视图:C:\xampp\htdocs\laravel_demo\resources\views\pages\registration.blade.php)
I refer the following link for installing forms and Html
我参考以下链接安装表单和 Html
My View page:
我的查看页面:
{{Form::open(array('action' => 'RegistrationController@store', 'method' => 'post'))}}
<table>
<tr>
<td>
Entr SNO:
</td>
<td>
{!! Form::text('sno', null, ['class' => 'form-control']) !!}
</td>
</tr>
<tr>
<td>
Enter Name:
</td>
<td>
{!! Form::text('sname', null, ['class' => 'form-control']) !!}
</td>
</tr>
<tr>
<td>
Enter Course:
</td>
<td>
{!! Form::text('course', null, ['class' => 'form-control']) !!}
</td>
</tr>
<tr>
<td>
Entr SNO:
</td>
<td>
{{ Form::select('number', [1, 2, 3], null, ['class' => 'field']) }}
</td>
</tr>
<tr>
<td>
{!! Form::submit('Submitform', ['class' => 'btn btn-primary']) !!}
</td>
<td>
{{ HTML::link('http://test.com') }}
</td>
</tr>
</table>
{!! Form::close() !!}
Form is working well but when i add 'href' link is not working.Please help me
表单运行良好,但是当我添加“href”链接时不起作用。请帮助我
回答by patricus
The issue is with the capitalization of the class you're trying to use.
问题在于您尝试使用的类的大小写。
If you followed the instructions for the laravelcollective/html
package, you will have added this alias in your config/app.php
file:
如果您按照laravelcollective/html
包的说明进行操作,您将在config/app.php
文件中添加此别名:
'Html' => Collective\Html\HtmlFacade::class,
However, in your blade, you're attempting to use the facade as HTML
. In your blade file, change your line to:
但是,在您的刀片中,您试图将外观用作HTML
. 在您的刀片文件中,将您的行更改为:
{{ Html::link('http://test.com') }}
Note: Html::
, not HTML::
.
注意:Html::
,不是HTML::
。
回答by Binit Ghetiya
You can try laravel :
你可以试试 laravel :
URL::route('router_name','parameter_if_require')
URL::route('router_name','parameter_if_require')
Do something like below for Example Here have single_postroute and it will take idso i can generate link some thing like below :
做类似下面的例子 这里有single_post路由,它会带id所以我可以生成一些像下面这样的链接:
<a href="{{ URL::route('single_post', $post->id) }}">View Post</a>
<a href="{{ URL::route('single_post', $post->id) }}">View Post</a>
For More check here
欲了解更多,请点击此处
And If you want to use direct link then you can use
如果你想使用直接链接,那么你可以使用
<a href="{{ URL::to('/your_static_url') }}">Name</a>
<a href="{{ URL::to('/your_static_url') }}">Name</a>
回答by anwerj
Laravel is removing HTML ServiceProvider from built in packages in 5.3, either you install it with LaravelCollectivesor use helper functions.
Laravel 正在从 5.3 的内置包中删除 HTML ServiceProvider,您可以使用LaravelCollectives安装它或使用辅助函数。
Helper function like url
or routes
, here you have to write you own html.
辅助函数像url
or routes
,这里你必须写你自己的html。
<a href="{{url('Could be absolute or relative')}}">name</a>
You can read about more helper function here, Laravel Helpers.
你可以在这里阅读更多的辅助函数,Laravel Helpers。
回答by Priyank lohan
<a href="{{'presentation_page'}}/{{$latest_file_uploads->id}}" class="title" title = "{{$latest_file_uploads->file_name}}" >
<a href="{{'presentation_page'}}/{{$latest_file_uploads->id}}" class="title" title = "{{$latest_file_uploads->file_name}}" >
try like this it will work great
像这样尝试它会很好用
回答by Sunil kumawat
Its html package error...so install HTML package and then move following steps. process(1)
它的 html 包错误...所以安装 HTML 包,然后移动以下步骤。流程(1)
step(1) Go -> composer.json-> "require":{ .... "laravelcollective/html": "~5.0"
step(2) cmd
C:\xampp\htdocs\any_project file> composer update
step(3) app.php-config
add folloewing these statement.
-> 'provider' => [ Collective\Html\HtmlServiceProvider::class, ]
->'aliases' => [ 'Html' => Collective\Html\HtmlFacade::class,
'Form' => Collective\Html\FormFacade::class,]
process(2)
流程(2)
step(1) Go -> composer.json-> "require":{ .... "illuminate/html":"5.*"
第1步) Go -> composer.json-> "require":{ .... "illuminate/html":"5.*"
step(2)
第2步)
cmd
C:\xampp\htdocs\any_project file> composer update
step(3) app.php-config
add folloewing these statement.
-> 'provider' => [ Illiminate\Html\HtmlSeviceProvider::class, ]
->'aliases' => [ 'Html' => Illuminate\Html\HtmlFacade::class,]