我的路线:
Router::connect('/', array('controller' => 'users', 'action' => 'homepage'));
Router::connect('/admin', array('controller' => 'users', 'action' => 'dashboard', 'admin' => true));
我的控制器
class BrandsController extends AppController {
/**
* Components
*
* @var array
*/
public $components = array('Paginator', 'Session', 'Flash');
var $paginate = array('limit' => 100);
/**
* admin_index method
*
* @return void
*/
public function admin_index()
{
index method
}
public function admin_searches()
{
searches method
}
我的链接
<?php echo Router::url(array('controller' => 'brands', 'action' => 'searches')); ?>
我有一个 admin_searches.ctp 文件,其中也有 hello world 文本。
问题是:当我有一个href链接时,
<a href="<?php echo Router::url(array('controller' => 'brands','action' => 'admin_index')); ?>">Brands List</a>
它工作正常并显示索引页面。现在,当我想显示搜索页面“admin_searches,ctp”时,它不会。我如何在链接中路由或修改路由文件,以便当我调用上述链接时,它会在我的控制器类中调用搜索方法