發(fā)表日期:2018-06 文章編輯:小燈 瀏覽次數(shù):3023
路由配置文件位置:caches/configs/route.php
我們打開這個配置文件,加入我們的路由配置信息。路由配置信息為二維數(shù)組結(jié)構(gòu),默認為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為一個二維數(shù)組,可設(shè)置POST和GET的默認參數(shù)。POST和GET分別對應(yīng)PHP中的$_POST和$_GET兩個超全局變量。如下面的例子,在程序中您可以使用$_POST['catid']來得到data下面POST中的數(shù)組的值。
data中的所設(shè)置的參數(shù)等級比較低。如果外部程序有提交相同的名字的變量,將會覆蓋配置文件中所設(shè)置的值。
如:
<?php
return array(
'default'=>array(
'm'=>'phpcms',
'c'=>'index',
'a'=>'init',
'data'=>array(
'POST'=>array(
'catid'=>1
),
'GET'=>array(
'contentid'=>1
)
)
)
)
?>
外部程序POST了一個變量catid=2那么你在程序中使用$_POST取到的值是2,而不是配置文件中所設(shè)置的1。
日期:2018-06 瀏覽次數(shù):3478
日期:2018-06 瀏覽次數(shù):3297
日期:2018-06 瀏覽次數(shù):3336
日期:2018-06 瀏覽次數(shù):3321
日期:2018-06 瀏覽次數(shù):3140
日期:2018-06 瀏覽次數(shù):3362
日期:2018-06 瀏覽次數(shù):3194
日期:2018-06 瀏覽次數(shù):3301
日期:2018-06 瀏覽次數(shù):3466
日期:2018-06 瀏覽次數(shù):3204
日期:2018-06 瀏覽次數(shù):2951
日期:2018-06 瀏覽次數(shù):2994
日期:2018-06 瀏覽次數(shù):3022
日期:2018-06 瀏覽次數(shù):2682
日期:2018-06 瀏覽次數(shù):2920
日期:2018-06 瀏覽次數(shù):2763
日期:2018-06 瀏覽次數(shù):2676
日期:2018-06 瀏覽次數(shù):2861
Copyright ? 2013-2018 Tadeng NetWork Technology Co., LTD. All Rights Reserved.