<?=是什么意思? [英] What does <?= mean?

查看:440
本文介绍了<?=是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此行的含义

<input type=text name="name" value="<?= $name ?>

如果我们要声明为PHP,则不应该编写<?php instead of <?=

if we are to declare as PHP shouldn't we write <?php instead of <?=

谢谢

推荐答案

<?=是PHP短开放标签,可以通过

<?= are PHP short open tags, which can be enabled (or disabled) via the short_open_tag directive in php.ini (quoting) :

此指令也会影响 速记<?=,相同 到<? echo.使用此快捷方式 要求short_open_tagon.

This directive also affects the shorthand <?= , which is identical to <? echo . Use of this shortcut requires short_open_tag to be on.

并且:

如果已禁用,还必须使用 PHP开放标记(<?php ?>)的长格式.

Also if disabled, you must use the long form of the PHP open tag (<?php ?> ).

这意味着您的代码部分:

This means your portion of code :

<input type=text name="name" value="<?= $name ?>

等效于此:

<input type=text name="name" value="<?php echo $name; ?>

但是只有启用短打开标签.

而且,作为一个旁注:短打开标记并不总是启用的-实际上,在最新版本的PHP中,默认情况下它们是禁用的.

And, as a sidenote : short open tags are not always enabled -- in fact, they are disabled by default, with recent versions of PHP.

这意味着不依赖于这些选项可能是明智的选择,至少如果您希望将应用程序部署在非管理员的服务器上.

Which means it might be wise to not depend on those, at least if you want to deploy your application on servers on which you are not administrator.

这篇关于&lt;?=是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆