问题描述
此行的含义
<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短开放标签,可以通过 php.ini
(引用)中的short_open_tag
指令:
<?=
are PHP short open tags, which can be enabled (or disabled) via the short_open_tag
directive in php.ini
(quoting) :
并且:
这意味着您的代码部分:
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.
这篇关于<?=是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!