Domanda

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 ?

È stato utile?

Soluzione

<?= 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.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top