Php 在yii tagcloud扩展中使用数组
我从以下链接使用yii标记云扩展 对于手动或静态值,它运行良好,但我想在这里使用数组。数组结构如下Php 在yii tagcloud扩展中使用数组,php,arrays,yii,yii-extensions,tag-cloud,Php,Arrays,Yii,Yii Extensions,Tag Cloud,我从以下链接使用yii标记云扩展 对于手动或静态值,它运行良好,但我想在这里使用数组。数组结构如下 Array ( [toy] => 2 [not-possible ] => 1 [peace] => 1 [nedds] => 1 [fullfilment] => 1 [pakistan] => 1 [no-terrorism] => 1 [message-for-musl
Array (
[toy] => 2
[not-possible ] => 1
[peace] => 1
[nedds] => 1
[fullfilment] => 1
[pakistan] => 1
[no-terrorism] => 1
[message-for-muslims] => 1
[a] => 1
[just ] => 1
[for-showoff] => 1
[a-dream] => 1
[peace-hen] => 1
[reality] => 1
)
其中key是标记,value是其频率。现在请告诉我如何使用这个小部件???将频率包装在
数组('weight'=>frequency)
中,以获得一个类似于手动/静态数组的数组,并将该数组传递到小部件中。小部件将适当地处理权重。将标签和权重存储在以下结构的数组中
Array (
[toy] => Array ( [weight] => 2 )
[not-possible ] => Array ( [weight] => 1 )
[peace] => Array ( [weight] => 1 )
[nedds] => Array ( [weight] => 1 )
[fullfilment] => Array ( [weight] => 1 )
[pakistan] => Array ( [weight] => 1 )
[no-terrorism] => Array ( [weight] => 1 )
[message-for-muslims] => Array ( [weight] => 1 )
[a] => Array ([weight] => 1 )
[just ] => Array ( [weight] => 1 )
[for-showoff] => Array ( [weight] => 1 )
[a-dream] => Array ( [weight] => 1 )
[peace-hen] => Array ( [weight] => 1 )
[reality] => Array ( [weight] => 1 )
)
并在行的小部件中使用此数组
'arrtags'=>$tagsarray,
谢谢@Topher的建议。你@Topher想说数组是以下形式的吗??阵法([震颤]=>阵法([体重]=>1)[愤怒情绪]=>阵法([体重]=>1)[鳄鱼]=>阵法([体重]=>1)[恐惧]=>阵法([体重]=>1)[个人]=>阵法([体重]=>1)[物品]=>阵法([体重]=>1)[缺失]=>阵法([体重]=>1))
'arrtags'=>$tagsarray,