为什么 Bootstrap 4 Glyphicon 不显示

Why Bootstrap 4 Glyphicon not showing

我的项目中包含以下 bootstrap CDN

<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>

并且我尝试在我的 php 脚本中以下列方式回显字形

echo '<div class="col-sm"><span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span>'.$deviceName.'</div>';

但是什么也没有出现。有谁知道为什么?

Bootstrap 4没有自己的图标库,BS4不支持Bootstrap 3的Glyphicons。但是,有许多免费的图标库可供选择,例如 Font Awesome 和 Google Material Design Icons。

像这样使用 FontAwesome 图标

@import "https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.4.0/css/font-awesome.css";
      <p>
          <i class="fa fa-spinner fa-spin"></i>
          <i class="fa fa-refresh fa-spin"></i>
          <i class="fa fa-cog fa-spin"></i>
      </p>
      <br>
      <p>
          <i class="fa fa-quote-left fa-2x pull-left fa-border"></i>
          Use a few styles together and you'll have easy pull quotes or a great introductory article icon.
      </p>
      <br>
      <h2>Stacked Icons</h2>
      <p>
          <span class="fa-stack fa-lg">
              <i class="fa fa-square-o fa-stack-2x"></i>
              <i class="fa fa-twitter fa-stack-1x"></i>
      </span>
      fa-twitter on fa-square-o<br>
      <span class="fa-stack fa-lg">
        <i class="fa fa-circle fa-stack-2x"></i>
        <i class="fa fa-flag fa-stack-1x fa-inverse"></i>
      </span>
      fa-flag on fa-circle<br>
      <span class="fa-stack fa-lg">
        <i class="fa fa-square fa-stack-2x"></i>
        <i class="fa fa-terminal fa-stack-1x fa-inverse"></i>
      </span>
      fa-terminal on fa-square<br>
      <span class="fa-stack fa-lg">
        <i class="fa fa-camera fa-stack-1x"></i>
        <i class="fa fa-ban fa-stack-2x text-danger"></i>
      </span>
      fa-ban on fa-camera
      </p>

参见代码 Code Link