2017-07-18 20 views
-1

我有一個字符串,我希望它隱藏HTML,因爲我將它打印到我的blade.php文件中。在php中隱藏一個字符串到html Laravel

字符串就像

"<a href=\"http://localhost/myProject/shop/Tom-Shop/MjNzaGFkb3c=\">Tom</a>" 

我已經在我的刀片得到執行相同的字符串下面的代碼輸出

<div class="commentText w100"> 
    <p >{{$comment['comment']}}</p> 
</div> 

,但我的代碼涉及到款, 我想打印錨標籤應該打印,

注意:我已經試過php htmlentit ies()爲此目的,並做R & D盡我所能,但沒有爲我工作。

+3

嘗試'{! $ comment ['comment'] !!}'輸出而不逃脫 –

+1

@VincentDecaux請發表一個答案。它值得接受 – user7597883

回答

1
{!! html_entity_decode($comment['comment']) !!} 

如果你正在使用laravel 5

1

您可以使用下面的語法也:

<?php echo $comment['comment']; ?> 

或者

在laravel的方式如下:

{!! $comment['comment'] !!} 
+0

感謝您的更正Alive to Die :) –

+0

Prabhu Nandan Kumar you'r welcome –

相關問題