我試着迴應這個。php laravel echo blade html錯誤
echo "<td><a href='{{ URL::to('index/watch/' . $tmpd) }}''>$tmpd </a></td>";
輸出必須http://localhost:8000/index/watch/myvar
,但它也http://localhost:8000/%7B%7B%20URL::to(
是什麼正如馬克·貝克說,不包括在echo
而且對整個發言我的回聲錯誤
我試着迴應這個。php laravel echo blade html錯誤
echo "<td><a href='{{ URL::to('index/watch/' . $tmpd) }}''>$tmpd </a></td>";
輸出必須http://localhost:8000/index/watch/myvar
,但它也http://localhost:8000/%7B%7B%20URL::to(
是什麼正如馬克·貝克說,不包括在echo
而且對整個發言我的回聲錯誤
使用laravel助手總是很好的做法。下面的代碼生成你正在尋找的html鏈接。
echo '<td>'.link_to('index/watch/'.$tmpd.'', $tmpd).'</td>';
我不知道它有.link非常感謝你 –
歡迎您:)查看這些laravel幫助函數https://laravel.com/docs/4.2/helpers#urls –
您需要使用非轉義標記的網址:{!! !!}
:
<td><a href='{!! URL::to('index/watch/' . $tmpd) !!}'>{{ $tmpd }}</a></td>
我可以使用PHP回聲? –
不,你不能,{{}}(又名刀片標籤)是PHP的回聲。 –
使用像blade這樣的模板系統的重點在於,您不必使用'echo'語句。 – Pitchinnate
不要將刀片模板語義{{...}}與PHP echo語句 –
混合在一起嗎? –
我不知道你是否已經跑過了Laracasts(或者如果你有和你恨他們(或者如果有人在互聯網上有他們並且他們討厭他們,在這種情況下這個評論可能會被忽略掉))但是Jeff對我來說感覺像[Blade]的一個非常紮實的介紹](https://laracasts.com/series/laravel-5-from-scratch/episodes/3),您可能需要查看這些內容。當我開始使用Laravel時,我發現系列的其餘部分也很有幫助。 – cbuchert