2017-06-02 75 views
0

我有這樣的一行代碼CakePHP的:添加鏈接到回波

<?php echo __('This is text and the word TEXT has to be a link'); ?> 

有什麼好的技巧單詞「TEXT」鏈接到另一個HREF地址?也許沒有改變整個結構?當我使用i18n翻譯作爲網站使用3種語言時,我想盡可能保持最小的變化。

在此先感謝!

回答

3

你可以嘗試通過您的鏈接作爲參數傳遞給__()函數:

<?= __('This is text and the word {0} has to be a link', $this->Html->link(...)) ?> 

更多信息可以在這裏找到: