1
我有一個名爲TagsController的控制器,它從index操作中的url中獲取標籤名稱以獲取具有該標籤的項目列表。CakePHP:將'tags/index/php'鏈接改爲'tags/php'
<?php
foreach($tags as $tag){
echo "<span class='homepagetags'>".$html->link($tag['t']['tag'], array('controller' => 'tags', $tag['t']['tag'])) . "</span> x " . $tag[0]['NumOccurrances'] . "<br><br>";
}
?>
鏈接帶我去'標籤/索引/ PHP的時候我真的希望它是「標籤/ PHP的
這是一個路由解決方案?
這是輝煌的,但現在唯一的問題是我的標籤控制器是給我和錯誤與功能索引($標籤){ \t \t \t \t}錯誤是'缺少參數1 TagsController :: index() '當我從行動中刪除參數錯誤消失 – iamjonesy 2010-10-22 06:40:10
回答我的問題上面:\t $ tag = mysql_real_escape_string($ this-> params ['tag']); – iamjonesy 2010-10-22 13:28:10
很高興你知道了! :) – Till 2010-10-23 08:54:01