E
E
evilelf2015-11-20 22:28:38
Yii
evilelf, 2015-11-20 22:28:38

How to link correctly?

Given: Yii 1.1.16

rules=>[
  array('mobile/api/list', 'pattern' => 'mobile/api/<model:\w+>', 'verb' => 'GET', 'parsingOnly' => true),
  array('mobile/api/view', 'pattern' => 'mobile/api/<model:\w+>/id/<id:\d+>', 'verb' => 'GET', 'parsingOnly' => true),
]

When Outputs: Required:$this->createUrl('api/games/id/',array('id'=>$ID))
/mobile/api/games/id?id=20
/mobile/api/games/id/20

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Makarov, 2015-11-20
@evilelf

1. Swap the rules.
2. model must also be specified.
3. parsingOnly means that the rules do not work when creating a URL.

A
Andrew, 2015-11-20
@R0dger

urlManager' => array(
        'urlFormat'=>'path',
        'showScriptName'=>false,
      ),

????

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question