我的域名末尾允许使用特殊字符(www.testing.com/home/login-)。我如何确保不允许这样做并且显示页面不存在,因为正确的URL是www.testing.com/home/login
$routeCustom = new \Zend_Controller_Router_Route(
'/:controller/:action',
array(
'module' => 'website',
"controller" => "default",
"action" => "default"
),
array(
'controller'=>'^[a-zA-Z-_0-9]+', //accept: a to z , A to Z , - , _ , 0-9
'action'=>'^[a-zA-Z-_0-9]+'
)
);
答案 0 :(得分:0)
$routeCustom = new \Zend_Controller_Router_Route(
'/:controller/:action',
array(
'module' => 'website',
"controller" => "default",
"action" => "default"
),
array(
'controller'=>'^[a-zA-Z-_0-9](.*[a-zA-Z0-9])$', //accept: a to z , A to Z , - , _ , 0-9
'action'=>'^[a-zA-Z-_0-9](.*[a-zA-Z0-9])$'
)
);