我需要把现有的routes.ini文件转换为XML文件(我的主机禁用PHP的parse_ini)。不管怎么说,我找不到合适的例子,所以我采用传统的Zend_Config_Xml中的结构试过我的运气。见下文:

<?xml version="1.0"?>
<configdata>
 <routes>
  <Home route=":locale/">
   <defaults controller="index" action="index" locale="tr_TR"/>
  </Home>
 </routes>
 <routes>
  <NewsList route=":locale/news-list/:pageID">
   <defaults controller="index" action="newsList" locale="tr_TR"/>
  </NewsList>
 </routes>
<configdata>

但是它不工作;例如上面写着“新闻列表”的路线是不存在的。我发现官方文档中的一些例子,但他们也没有帮助。

有人可以协助在正确的XML结构?

谢谢, 戈克钦

有帮助吗?

解决方案

<?xml version="1.0"?>
<configdata>
  <routes>
      <Home route=":locale/">
          <defaults controller="index" action="index" locale="tr_TR"/>
      </Home>
      <NewsList route=":locale/news-list/:pageID">
          <defaults controller="index" action="newsList" locale="tr_TR"/>
      </NewsList>
  </routes>
<configdata>

我想你不应该使用两个单独的路由标签,包装两个规则之一。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top