深圳全飞鸿

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 641|回复: 0
打印 上一主题 下一主题

beaco框架下Route控制的逻辑修订

[复制链接]

800

主题

1379

帖子

7705

积分

版主

Rank: 7Rank: 7Rank: 7

积分
7705
跳转到指定楼层
楼主
发表于 2019-9-10 09:23:10 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
beaco框架下Route控制的逻辑修订

第一版:

  1.                 //此处需要修改逻辑,不能以文件的存在来判断,应该要允许无文档模式
  2.                 $ary=explode('/',$uri);
  3.                 if( (count($ary)>1) && (!in_array(strtolower($ary[0]),array("nago","menu")))
  4.                         ){
  5.                         //表示要走进阶模式,此时,不放模板也可以,由框架自动从父类继承!
  6.                         $uri = $ary[0]."/".$ary[1];
  7.                         $_path = $config->base_path."/{$config->dir_template}/{$uri}";
  8.                         $this->url_target=$_path;
  9.                         //$TargetPath= $_path;
  10.                         //$Target = true;                               
  11.                 }else{
  12.                         //还是走传统模式
  13.                         while(!empty($uri))
  14.                         {
  15.                                 $uri = substr($uri, 0, strrpos($uri, '/'));
  16.                                 $_path = $config->base_path."/{$config->dir_template}/{$uri}";
  17.                                 if(        file_exists($_path) && !is_dir($_path) ||
  18.                                         file_exists("{$_path}/index.php") ||
  19.                                         file_exists("{$_path}.php") ||
  20.                                         file_exists("{$_path}/index.html") ||
  21.                                         file_exists("{$_path}.html") ||
  22.                                         file_exists("{$_path}/index.htm") ||
  23.                                         file_exists("{$_path}.htm")  )
  24.                                 {
  25.                                          $this->url_target=$_path;
  26.                                          // $TargetPath= $_path;
  27.                                          //$Target = true;
  28.                                          break;
  29.                                 }
  30.                                
  31.                         }
  32.                 }
  33.                 //
  34.                 $segment = explode('/', substr($para, strlen($uri), -1));
  35.                 $smarty->assign("segment", $segment);
  36.                 $smarty->assign("uri", $uri);        // 存储在Smarty中,以备使用
  37.                 $smarty->force_compile = true;  //这个到时注意一下,发布的时间一定记得改为false
  38.                    //for debug
  39.                 //$smarty->Target = $Target;
  40.                 //$smarty->TargetPath=$TargetPath;
复制代码
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|nagomes  

GMT+8, 2025-5-5 06:20 , Processed in 0.023984 second(s), 21 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表