PHP Code not Recognized in CTP file
php script is not recognized with script tags, if I use then the code runs just fine.
Works:
<?php $layout->sessionFlash(); ?>
Doesn't Work:
<?$layout->sessionFlash();?>
Works:
<?php echo $content_for_layout; ?>
Doesn't Work:
<?=$content_for_layout;?>
This is code taken from another website that works correctly on the server but I am tryin开发者_运维技巧g to get it working on my local wamp server and I am running into this issue. It is only in the .ctp files.
Like Babiker already said, short_open_tag
has to be set to 1
in your php.ini
. But to be on the safe side, you should only use long tags and echo
in your code, as you cannot be sure if the PHP server you might your application deploy to has short tags enabled.
精彩评论