深圳全飞鸿
标题:
beaco框架下Route控制的逻辑修订
[打印本页]
作者:
zhgc
时间:
2019-9-10 09:23
标题:
beaco框架下Route控制的逻辑修订
beaco框架下Route控制的逻辑修订
第一版:
//此处需要修改逻辑,不能以文件的存在来判断,应该要允许无文档模式
$ary=explode('/',$uri);
if( (count($ary)>1) && (!in_array(strtolower($ary[0]),array("nago","menu")))
){
//表示要走进阶模式,此时,不放模板也可以,由框架自动从父类继承!
$uri = $ary[0]."/".$ary[1];
$_path = $config->base_path."/{$config->dir_template}/{$uri}";
$this->url_target=$_path;
//$TargetPath= $_path;
//$Target = true;
}else{
//还是走传统模式
while(!empty($uri))
{
$uri = substr($uri, 0, strrpos($uri, '/'));
$_path = $config->base_path."/{$config->dir_template}/{$uri}";
if( file_exists($_path) && !is_dir($_path) ||
file_exists("{$_path}/index.php") ||
file_exists("{$_path}.php") ||
file_exists("{$_path}/index.html") ||
file_exists("{$_path}.html") ||
file_exists("{$_path}/index.htm") ||
file_exists("{$_path}.htm") )
{
$this->url_target=$_path;
// $TargetPath= $_path;
//$Target = true;
break;
}
}
}
//
$segment = explode('/', substr($para, strlen($uri), -1));
$smarty->assign("segment", $segment);
$smarty->assign("uri", $uri); // 存储在Smarty中,以备使用
$smarty->force_compile = true; //这个到时注意一下,发布的时间一定记得改为false
//for debug
//$smarty->Target = $Target;
//$smarty->TargetPath=$TargetPath;
复制代码
欢迎光临 深圳全飞鸿 (http://www.nagomes.com/disc/)
Powered by Discuz! X3.2