Yii URL规则重写

时间:2016-11-01 16:06:25

标签: url yii

我在URL main.php urlManagerrules中有以下the-urly-bird规则:

blog/content/index => URL

此页面(http://www.accesstheflock.io/the-urly-bird)有10页内容。我希望每个网页都拥有自己的?r=blog/content/index&Content_page=2,例如:http://www.accesstheflock.io/the-urly-bird/page/2

每个页面的路径为:URL

请为main.php提供String test="[a-zA-Z][a-zA-Z\\-]*"; Pattern p = Pattern.compile(test); Matcher m = p.matcher(textInputWord.getText()); if(m.find()){ String temp = textInputWord.getText(); wordArrayList.add(temp); labelMainText.setText("Word " + textInputWord.getText() + " was added to the ArrayList."); }else{ labelMainText.setText("The string " + textInputWord.getText() + " was not added to the list as it is not a valid word."); } 规则以使其发挥作用。非常感谢。谢谢。

1 个答案:

答案 0 :(得分:0)

我能够编写工作URL规则并在点击事件处理程序上添加jQuery,以重定向到分页的正确URL。

main.php

'the-urly-bird/page/<page:\d+>'=>'blog/content/index', 
'the-urly-bird' => 'blog/content/index', 

视图

$('li.page a').on('click', function() { //Redirects 
  window.location.href = $(this).attr('href'); 
  return false; 
}); –