我正在使用MTHAML和Yii。我有以下几行。
-use yii\helpers\Url
%a{:href => Url::toRoute(['shopping/ping', 'id' => (string)$item->productId, 'category' => (string)$item->primaryCategory->categoryId])} test
但是它会出错。
<?php
function __MtHamlTemplate_65307eb071e28021db686cb46d491c8faae477235051858b05f212731637dd40($__variables)
{
extract($__variables);
?><?php use yii\helpers\Url; ?>
答案 0 :(得分:1)
答案 1 :(得分:0)
由于编译html缓存时命名空间无效。 请从root nb
尝试%a{:href => \yii\helpers\Url::toRoute(['shopping/ping', 'id' => (string)$item->productId, 'category' => (string)$item->primaryCategory->categoryId])} test