是否可以在 .phtml 文件中使用 'use as' 作为命名空间?
Is it possible to use 'use as' for namespaces in a .phtml file?
在 .phtml 文件中,可以执行以下操作吗?
<?php use App\Library as Lib; ?>
<h3><?php Lib::getTitle(); ?></h3>....
我有一个 .phtml 文件,它使用实用程序 class 来制作下拉菜单等等,不想为所有内容键入整个命名空间。
在此先感谢您的帮助。
如果您像这样配置了服务器,使用 .phtml
文件应该与使用 .php
文件完全相同。
See this question(如果您是 运行 Apache)。
在 .phtml 文件中,可以执行以下操作吗?
<?php use App\Library as Lib; ?>
<h3><?php Lib::getTitle(); ?></h3>....
我有一个 .phtml 文件,它使用实用程序 class 来制作下拉菜单等等,不想为所有内容键入整个命名空间。
在此先感谢您的帮助。
如果您像这样配置了服务器,使用 .phtml
文件应该与使用 .php
文件完全相同。
See this question(如果您是 运行 Apache)。