What does this symbol mean in PHP <?=

2019-01-04 15:00发布

What does this symbol mean in PHP <?=?

Example usage:

<h2>Manage Role: > (<?= $myACL->getRoleNameFromID($_GET['roleID']); ?>)</h2> 

标签: php symbol
4条回答
不美不萌又怎样
2楼-- · 2019-01-04 15:06

To add to Mark's answer: The short_tags option must be enabled for the <?= syntax to be valid. This presents a major portability problem when moving to a server that has this option disabled.

See the PHP Manual for more info on short tags

查看更多
Summer. ? 凉城
3楼-- · 2019-01-04 15:08

It's functionally the same as <?php echo $myACL->getRoleNameFromID($_GET['roleID']); ?>

查看更多
神经病院院长
4楼-- · 2019-01-04 15:20
The <?= ... > tag says to execute whatever is in ... and output the results.
查看更多
可以哭但决不认输i
5楼-- · 2019-01-04 15:24

It's the PHP Short Tag equivalent of printing.

From the PHP INI:

Using short tags is discouraged when developing code meant for redistribution ; since short tags may not be supported on the target server.

See "Are PHP Short Tags Acceptable to Use?" on StackOverflow.

查看更多
登录 后发表回答