URL 末尾允许有特殊字符。为什么?
URL allows special character in the end. Why?
我的域名允许在末尾使用特殊字符 (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]+'
)
);
是这样的:
$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])$'
)
);
我的域名允许在末尾使用特殊字符 (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]+'
)
);
是这样的:
$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])$'
)
);