controller
1.創建controller
controller
1.創建controller Route::get('/','SitesController@index');
controller
1.創建controller
controller
1.創建controller
`php artisan make:controller controllername`註:`php artisan make:controller controllername –plain`不攜帶自訂方法
2.使用controllerRoutes:
SC:
<code><span>public</span><span><span>function</span><span>index</span><span>()</span> {</span><span>return</span><span>"sjming"</span>; }</code>
SC:
<code><span>public</span><span><span>function</span><span>index</span><span>()</span> {</span><span>$name</span> = <span>'sjming'</span>; <span>return</span> view(<span>'welcome'</span>)->with(<span>'name'</span>,<span>$name</span>); }</code>
<code><span>return</span> view<span><span>(<span>'welcome'</span>)</span>-></span><span>with</span>([ <span>'name'</span><span>=></span>$name, <span>'first'</span><span>=></span><span>'su'</span> ]);</code>
<code><span>$data</span>=[]; <span>$data</span>[<span>'first'</span>]=<span>'123'</span>; <span>$data</span>[<span>'second'</span>]=<span>'456'</span>; <span>return</span> view(<span>'sites.about'</span>,<span>$data</span>);</code>
<code><span>$fir</span>=<span>'123'</span>; <span>$sec</span>=<span>'456'</span>; <span>return</span> view(<span>'sites.about'</span>,compact(<span>'fir'</span>,<span>'sec'</span>));</code>4.參數使用 (4)php的compactrrreee
4.參數使用
轉義方式:{{}} //其中的html不解釋不轉義方式:{!! !!} //其中的html解釋
🎜blade模板🎜🎜🎜@yield('xxx'),@extends('xxx')🎜🎜@section('xxx'),@ stop🎜🎜🎜').addClass('pre-numbering').hide(); $(this).addClass('has-numbering').parent().append($numbering); for (i = 1; i 🎜').text(i)); }; $numbering.fadeIn(1700); }); }); 🎜 🎜 以上就介紹了laravel(一)路由,參數傳遞,blade,包括了laravel,blade方面的內容,希望對PHP教程有興趣的朋友有所幫助。 🎜 🎜 🎜