【问题标题】:Is it possible to use 'use as' for namespaces in a .phtml file?是否可以对 .phtml 文件中的命名空间使用“用作”?
【发布时间】:2015-05-28 06:46:29
【问题描述】:

在 .phtml 文件中,可以执行以下操作吗?

<?php use App\Library as Lib; ?> <h3><?php Lib::getTitle(); ?></h3>....

我有一个 .phtml 文件,它使用 Utility 类来制作下拉菜单等等,我不想为所有内容输入整个命名空间。

提前感谢您的帮助。

【问题讨论】:

  • 如果你已经像这样配置你的服务器,使用.phtml文件应该与使用.php文件完全相同。
  • 我是这么想的,但我想确定一下。谢谢,@D4V1D。

标签: html namespaces php


【解决方案1】:

如果您已经这样配置服务器,使用 .phtml 文件应该与使用 .php 文件完全相同。

See this question(如果您正在运行 Apache)。

【讨论】:

    猜你喜欢
    • 2015-01-14
    • 2020-07-20
    • 2013-06-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多