Skip to content

Commit

Permalink
#2 完善默认控制器传送参数的获取
Browse files Browse the repository at this point in the history
  • Loading branch information
breath-co2 committed Aug 13, 2013
1 parent 30d139f commit 7938cf2
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions core/classes/core.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -837,8 +837,9 @@ protected static function find_controller($uri)
$args = array();
}

$the_id = array();
$the_id = array();
$tmp_class = array_shift($args);
$tmp_arg = $tmp_class;

if (0===strlen($tmp_class))
{
Expand All @@ -863,6 +864,11 @@ protected static function find_controller($uri)
// 记录找到的index.controller.php
$found_index_class = null;

if (IS_DEBUG)
{
$find_log2 = array();
}

foreach ($all_path as $tmp_arr)
{
list($ns, $tmp_path, $real_path, $ids) = $tmp_arr;
Expand Down Expand Up @@ -896,15 +902,16 @@ protected static function find_controller($uri)
$tmpfile = $tmp_path . 'index' . Core::$dir_setting['controller'][1] . EXT;
if (IS_DEBUG)
{
$find_log[] = Core::debug_path($tmpfile);
$find_log2[] = Core::debug_path($tmpfile);
}

if (is_file($tmpfile))
{
if ($the_id)
{
$ids = array_merge($ids, $the_id);
array_unshift($args, $tmp_arg);
}

$found_index_class = array
(
'file' => $tmpfile,
Expand All @@ -917,6 +924,11 @@ protected static function find_controller($uri)
}
}

if (IS_DEBUG && $find_log2)
{
$find_log = array_merge($find_log, $find_log2);
}

// index.controller.php 文件
if (!$found && $found_index_class)
{
Expand All @@ -935,7 +947,7 @@ protected static function find_controller($uri)
}
Core::debug()->groupEnd();

Core::debug()->group('find controller file');
Core::debug()->group('find controller files');
foreach ($find_log as $value)
{
Core::debug()->log($value);
Expand Down

0 comments on commit 7938cf2

Please sign in to comment.