發(fā)表日期:2018-06 文章編輯:小燈 瀏覽次數(shù):2950
路由配置文件位置:caches/configs/route.php
我們打開這個(gè)配置文件,加入我們的路由配置信息。路由配置信息為二維數(shù)組結(jié)構(gòu),默認(rèn)為default。
路由配置文件內(nèi)容是這樣的:
<?php
return array(
'default'=>array('m'=>'admin', 'c'=>'index', 'a'=>'init'),
'test.youname.com'=>array('m'=>'test', 'c'=>'index', 'a'=>'init'),
);
?>
基中“m”為模型,“c”為控制器,“a”為事件,“data”為其他附加參數(shù)。
data為一個(gè)二維數(shù)組,可設(shè)置POST和GET的默認(rèn)參數(shù)。POST和GET分別對(duì)應(yīng)PHP中的$_POST和$_GET兩個(gè)超全局變量。如下面的例子,在程序中您可以使用$_POST['catid']來(lái)得到data下面POST中的數(shù)組的值。
data中的所設(shè)置的參數(shù)等級(jí)比較低。如果外部程序有提交相同的名字的變量,將會(huì)覆蓋配置文件中所設(shè)置的值。
如:
<?php
return array(
'default'=>array(
'm'=>'phpcms',
'c'=>'index',
'a'=>'init',
'data'=>array(
'POST'=>array(
'catid'=>1
),
'GET'=>array(
'contentid'=>1
)
)
)
)
?>
外部程序POST了一個(gè)變量catid=2那么你在程序中使用$_POST取到的值是2,而不是配置文件中所設(shè)置的1。
日期:2018-06 瀏覽次數(shù):3429
日期:2018-06 瀏覽次數(shù):3253
日期:2018-06 瀏覽次數(shù):3298
日期:2018-06 瀏覽次數(shù):3275
日期:2018-06 瀏覽次數(shù):3083
日期:2018-06 瀏覽次數(shù):3295
日期:2018-06 瀏覽次數(shù):3121
日期:2018-06 瀏覽次數(shù):3259
日期:2018-06 瀏覽次數(shù):3410
日期:2018-06 瀏覽次數(shù):3153
日期:2018-06 瀏覽次數(shù):2903
日期:2018-06 瀏覽次數(shù):2946
日期:2018-06 瀏覽次數(shù):2949
日期:2018-06 瀏覽次數(shù):2626
日期:2018-06 瀏覽次數(shù):2876
日期:2018-06 瀏覽次數(shù):2719
日期:2018-06 瀏覽次數(shù):2631
日期:2018-06 瀏覽次數(shù):2819
Copyright ? 2013-2018 Tadeng NetWork Technology Co., LTD. All Rights Reserved.