Pergunta

I'm using CakePHP.

Today I tried to link a page of the Page Controller to another page from the Page controller, and I couldn't get to see the link until I wrote

<?= $this->Html->link('myPage', array('controller' => 'pages', 'action' =>
    'myPage')); ?>

Why did I have to write <?= and not <?php ?

Generally speaking, when do I have to use <?= and when <?php ?

Foi útil?

Solução

<?= is short for <?php echo

Add echo to your code and it will work.

This is not unique to CakePHP, it's just part of PHP.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top