PHP中的特殊标签

发布于 2024-08-29 07:11:57 字数 87 浏览 3 评论 0原文

谁能解释一下 php 中这些特殊标签是什么?

<?= ?>

我在谷歌上找不到它。

can anybody please explain what are these special tags in php?

<?= ?>

I couldn't find it on google.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

青丝拂面 2024-09-05 07:11:57

请参阅 short_open_tags 设置。
并使用它需要打开 short_open_tag。要搜索的术语是“短标签”。

例如: 的缩写形式。

另请参阅 PHP 短标签可以使用吗? 此处。

See the short_open_tags setting.
<?= is identical to <? echo and use of it requires short_open_tag to be on. A term to search for would be "short tags".

As an example: <?='hello'?> is identical to <? echo 'hello' ?> which is a short form of <?php echo 'hello' ?>.

See also Are PHP short tags acceptable to use? here on SO.

末が日狂欢 2024-09-05 07:11:57

它是 short_open_tag 的一部分。基本上 相当于

It's part of the short_open_tag. Basically <?=$foo?> is equivalent to <?php echo $foo; ?>

怪我鬧 2024-09-05 07:11:57

他们直接输出里面的内容。

<?= "something" ?>

是以下内容的快捷方式:

<?php echo "something"; ?>

这些(与 一起)称为短标签。 参见此处 (short_open_tag)

They output what's inside them directly.

<?= "something" ?>

is a shortcut for:

<?php echo "something"; ?>

These (together with <? ?>) are called short tags. See here (short_open_tag)

任性一次 2024-09-05 07:11:57

我不建议使用这些短标签,因为在某些网络服务器环境中它们是通过 PHP 配置禁用的。

<?= $foobar ?> is a shortcut for <?php echo $foobar; ?>.

I wouldn't recommend using these short tags because in some webserver environments they are disabled via PHPs configuration.

留一抹残留的笑 2024-09-05 07:11:57

是的,您可以使用 .htaccess 来完成。在您的 .htaccess 文件中添加此

php_value short_open_tag 1

现在您可以使用 而不是 检查文件>

yes you can done it using .htaccess. In your .htaccess file, add this

php_value short_open_tag 1

Now you can check files with <?='hi';?> instead of <?php ?>

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文