2016-10-03 24 views
-2

原因和目的是什麼CakePHP中爲什麼和什麼樣的目的使用此<?= ?>語法CakePHP中

代碼示例

<h1> 
    Getting All bookmarks with certain Tags: 
    <?= $this->Text->toList($tags); ?> 
</h1> 

<section> 
    <?php foreach ($bookmarks as $bookmark) { ?> 
     <article> 
      <h4><?= $this->Html->link($bookmark->title, $bookmark->url); ?></h4> 
      <small><?= h($bookmark->url) ?></small> 
      <?= $this->Text->autoParagraph($bookmark->description); ?> 
     </article> 
    <?php } ?> 
</section> 

回答

4

它是短回波語法使用此<?= ?>語法。它是PHP的一個內置部分,並不特定於CakePHP框架。但是,CakePHP coding standards聲明它應該用於模板文件而不是<?php echo ...

+0

謝謝@不要驚慌!我得到了答案! – Momin

相關問題