搜尋
首頁php框架Laravel聊聊laravel5中Form與HTML的使用

#最近在用laravel 5 做例子,在做到表單的時候,習慣性的使用Form::open()結果發現提示錯誤,沒有這個類,

好吧,找了找,發現在laravel 5 中,把from 和html 單獨的提出去了,下面就是安裝使用方法啦

加入composer.json

<code><br> "require": {
        "illuminate/html": "~5.0"
    },</code>

更新

<code><br>composer update</code>

更新後,開啟/config/app.php

##在

providers 陣列下面加上

<code><br>'Illuminate\Html\HtmlServiceProvider',</code>

aliases 陣列下面加上

'Form'      => 'Illuminate\Html\FormFacade',
'HTML'      => 'Illuminate\Html\HtmlFacade'
這樣就安裝好啦!

使用方法

以前寫法是這樣的

{{Form::open()}}

{{Form::close()}}
現在變成這樣的了

{!! Form::open() !!}

{!! Form::close() !!}

以下這段參考於@安靜的文章如果不太適應使用{!! HTML::script() !!}

請到路由檔案routes.php中,設定以下程式碼

<code><br>Blade::setRawTags('{{', '}}');</code>
即可回歸到{{ HTML::script('js/jquery.js') }}

參考完成 文章地址http://wenda.golaravel.com/article/242

基本上就是這樣,更多的使用方法可以看手冊http://laravelcollective.com/

#推薦學習:《

laravel教學


以上是聊聊laravel5中Form與HTML的使用的詳細內容。更多資訊請關注PHP中文網其他相關文章!

陳述
本文轉載於:segmentfault。如有侵權,請聯絡admin@php.cn刪除
任務管理工具:遠程項目的優先級和跟踪進度任務管理工具:遠程項目的優先級和跟踪進度May 02, 2025 am 12:25 AM

taskManagementsToolSareEssentialForefectiverMototeprojectManagementbyPrioritizingTaskSandTrackingProgress.1)USETOOLSLIKETRELLOANDASANATASANATOSETPRIORITIONTAGS.2)

最新的Laravel版本如何提高性能?最新的Laravel版本如何提高性能?May 02, 2025 am 12:24 AM

Laravel10enhancesPerformancEthroughSeveralKeyKeyFeatures.1)itintroducesquereBuilderCachingTordorcachingTordOuctedSataBaseload.2)itoptimiesseloizeseloquentmodelloAdingwithlazyproxies.3)

全棧Laravel應用程序的部署策略全棧Laravel應用程序的部署策略May 02, 2025 am 12:22 AM

最佳的全棧Laravel應用部署策略包括:1.零停機部署,2.藍綠部署,3.持續部署,4.金絲雀發布。 1.零停機部署使用Envoy或Deployer自動化部署過程,確保應用在更新時保持可用。 2.藍綠部署通過維護兩個環境實現無停機部署,並允許快速回滾。 3.持續部署通過GitHubActions或GitLabCI/CD自動化整個部署流程。 4.金絲雀發布通過Nginx配置,將新版本逐步推廣給用戶,確保性能優化和快速回滾。

擴展全堆棧Laravel應用程序:最佳實踐和技術擴展全堆棧Laravel應用程序:最佳實踐和技術May 02, 2025 am 12:22 AM

toscalealaravelApplication有效,焦點databaseSharding,緩存,負載平衡和microservices.1)實現DataBasEshardingTodistaCripedataCrossmultipledataBasesForimProvesforimPrevperformance.2)uselaravel'scachingsystemystemystemystemywithredsormememememememcachedtebachedtebab

沉默的鬥爭:克服分佈式團隊中的溝通障礙沉默的鬥爭:克服分佈式團隊中的溝通障礙May 02, 2025 am 12:20 AM

doovercomecommunicationbarriersIndistributedTeams,使用:1)VideoCallSforface-to-Faceinteraction,2)setClearresponsEtimepections,3)chooseappropropropraproproprapropropriatecommunicationTools,4)CreatseateAteAteAteamCommunicationGuide和5)建立PemersonalBoundariestAriestOpeopReventBreventBurniationBurnication.the

使用Laravel Blade在全棧項目中進行前端模板使用Laravel Blade在全棧項目中進行前端模板May 01, 2025 am 12:24 AM

laravelbladeenhancesfrontendtemplatinginflatinginflationll-stackprojectsbyferingCleanSyntaxandaxandpoperfelfulfeatures.1)itallowsforeasyvariableasyvariabledisplayandControlstructures.2)bladesuportsuportsuportscreatingingingingingingingingingingangingandredreingscomponents components components components,aidinginmanagingcomplexuis.3)

使用Laravel:實用教程構建全堆棧應用程序使用Laravel:實用教程構建全堆棧應用程序May 01, 2025 am 12:23 AM

laravelisidealforll-stackapplicationsduetoitselegantsyntax,complastissionecosystem和perperatedfulfeatures.1)useeloquentormforintuivelbackenddatamanipulation,butavoidn 1queryissues.2)

您使用哪種工具來保持遠程角色保持連接?您使用哪種工具來保持遠程角色保持連接?May 01, 2025 am 12:21 AM

forremotework,iusezoomforvideOcalls,Slackformessing,trelloforprojectmanagement,and giThubForCodeCollaboration.1)Zoomisreliable forlailible forlargemeetingsbuthastimelimitsonthefreeversion.2)

See all articles

熱AI工具

Undresser.AI Undress

Undresser.AI Undress

人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover

AI Clothes Remover

用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool

Undress AI Tool

免費脫衣圖片

Clothoff.io

Clothoff.io

AI脫衣器

Video Face Swap

Video Face Swap

使用我們完全免費的人工智慧換臉工具,輕鬆在任何影片中換臉!

熱工具

SublimeText3漢化版

SublimeText3漢化版

中文版,非常好用

VSCode Windows 64位元 下載

VSCode Windows 64位元 下載

微軟推出的免費、功能強大的一款IDE編輯器

Dreamweaver CS6

Dreamweaver CS6

視覺化網頁開發工具

Dreamweaver Mac版

Dreamweaver Mac版

視覺化網頁開發工具

SublimeText3 Linux新版

SublimeText3 Linux新版

SublimeText3 Linux最新版