在 CakePHP 中我想做特定的路由规则(主要是出于美观和 SEO 的原因)。
因此,例如,我在代码中所做的事情是这样的:
Router::connect('/c/:uni.html', array('controller' => 'contents', 'action'=>'index'));
现在如果有人打电话
MY_SITE/anyController/anyAction
我不希望 CakePHP 去那里,即使这个 Controller 确实存在(当然还有动作......)
例子:
class AnyController extends AppController {
var $helper = array('Html');
/**
* landingpage
*/
private function anyAction() {
//this action must not be called by /anyController/anyAction
//but only by my own defined route
}
}