加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

php – Zend翻译的路线

发布时间:2020-12-13 17:51:43 所属栏目:PHP教程 来源:网络整理
导读:我有不同的语言环境的多个路由: 例: 路线为/ de $routes['industry'] = array( 'route' = 'branche/:type','defaults' = array( 'module' = 'default','controller' = 'index','action' = 'branche','type' = 'automobil' ),'reqs' = array( 'type' = '(au
我有不同的语言环境的多个路由:

例:

路线为/ de

$routes['industry'] = array(
    'route' => 'branche/:type','defaults' => array(
        'module' => 'default','controller' => 'index','action' => 'branche','type' => 'automobil'
    ),'reqs' => array(
        'type' => '(automobil|textil)'
    )
);

路线为/ en

$routes['industry'] = array(
    'route' => 'industry/:type','type' => 'car'
    ),'reqs' => array(
        'type' => '(car|textile)'
    )
);

在这种情况下,它可能以某种方式只有一条路线而不是2条路线?

注意不仅是更改的路由,还有reqs上的类型和默认类型.

我在那里看到两条不同的路线
通常国际化在页面上,但不在URL上

让我说清楚,你保留你的网址和网址中的参数,你知道页面的语言

$routes['industry'] = array(
    'route' => 'industry/:lang/:type','type' => 'car','lang' => 'en'
    ),'reqs' => array(
        'lang' => '(en|de)','type' => '(car|textile)'
    )
);

并且根据参数lang,您可以在twig或phtml或html上显示正确的消息

另一种更改URL的方法是:

$routes['industry'] = array(
    'route' => ':industry/:type','industry' => 'industry'
    ),'reqs' => array(
        'industry' => '(industry|branche)','type' => '(car|textile)'
    )
);

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读