【发布时间】:2015-05-24 12:22:02
【问题描述】:
我正在使用MTHAML 和 Yii。我有以下几行。
-use yii\helpers\Url
%a{:href => Url::toRoute(['shopping/ping', 'id' => (string)$item->productId, 'category' => (string)$item->primaryCategory->categoryId])} test
但是它给出了一个错误。
语法错误,意外的“使用”(T_USE)
<?php
function __MtHamlTemplate_65307eb071e28021db686cb46d491c8faae477235051858b05f212731637dd40($__variables)
{
extract($__variables);
?><?php use yii\helpers\Url; ?>
【问题讨论】:
-
您的使用声明前面有一个破折号。那应该在那里吗?看起来不太对劲
-
@JoeMiller 那是 HAML!你会喜欢的! haml.info/docs/yardoc/file.REFERENCE.html#running_ruby_
-
:-) 从未使用过它,但我必须承认有点感兴趣。不过我必须使用php版本,不能设置一个ruby服务器。
-
当然好!他们也有 PHP 版本!试试非 Yii github.com/arnaud-lb/MtHaml
标签: php yii namespaces haml yii2