0

我有这个段路线:

'content' => array(
    'type'    => 'Segment',
    'options' => array(
        'route'    => '/:title{-}-:id',
        'constraints' => array(
            'title'         => '[a-zA-Z0-9_-]*',
            'id'            => '[0-9]+',
        ),
        'defaults' => array(
            'controller'    => 'content',
            'action'        => 'index',
        ),
    ),
),

它可以正确识别这样的 url,带有“id=20”:

http://example.com/blood-on-ice-20

但它也可以通过以下网址识别“id=20”:

http://example.com/timekeeper-20th-anniversary-box-12951

我怎样才能避免这种情况?

4

0 回答 0