Html 以问号开头的标签?

Html tag beginning with question mark?

我正在学习 google 应用程序脚本,在 this 教程中,我看到了一些看起来很奇怪的语法:<? /* JS code */ ?><?= /* JS code */ ?>

<!DOCTYPE html>
<html>
  <head>
    <base target="_top">
    <title>Message Display Test</title>
    <link rel="stylesheet" href="https://ssl.gstatic.com/docs/script/css/add-ons1.css">
  </head>
  <body style="padding:3em;">
  <h1>Messages</h1>
    <ul>
    <? for(var m=0;m<messages.length;m++){ ?>
    <li><?= messages[m].getSubject() ?></li>
    <p><?= messages[m].getPlainBody() ?></p>
    <? } ?>
    </ul>
  </body>
</html>

我有点明白是怎么回事了,但我还是一头雾水。我在学习时从未见过这些HTML。这与脚本标签相比如何?

问号用于PHP,并入html起作用。它是另一种与网页设计相关的编程语言。 PHP主要用于制作更高级的表单系统

在 Google Apps Script 中,<? . . .?> 称为标准 scriptlet,<?= . . . ?> 是打印的 scriptlet,<?!= . . . ?> 是强制打印的 scriptlet。它们用于 Google Apps 脚本 HTML 服务模板 HTML。

资源

相关

  • How to use scriptlets in HTMLOutput in Google Apps Script