Route类调整

This commit is contained in:
thinkphp
2016-02-29 13:55:55 +08:00
parent d93d0feb2a
commit 0ab55d6246
4 changed files with 6 additions and 7 deletions

View File

@@ -69,8 +69,8 @@ class Route
{ {
if (is_array($name)) { if (is_array($name)) {
self::${$var} = self::${$var}+$name; self::${$var} = self::${$var}+$name;
} elseif (empty($name)) { } elseif (empty($value)) {
return self::${$var}; return empty($name) ? self::${$var} : self::${$var}[$name];
} else { } else {
self::${$var}[$name] = $value; self::${$var}[$name] = $value;
} }

View File

@@ -30,11 +30,11 @@ class Email
* 通知发送接口 * 通知发送接口
* @access public * @access public
* @param string $msg 日志信息 * @param string $msg 日志信息
* @return void * @return bool
*/ */
public function send($msg = '') public function send($msg = '')
{ {
error_log($msg, 1, $this->config['address']); return error_log($msg, 1, $this->config['address']);
} }
} }

View File

@@ -73,8 +73,7 @@ class File
$server = isset($_SERVER['SERVER_ADDR']) ? $_SERVER['SERVER_ADDR'] : '0.0.0.0'; $server = isset($_SERVER['SERVER_ADDR']) ? $_SERVER['SERVER_ADDR'] : '0.0.0.0';
$remote = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '0.0.0.0'; $remote = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '0.0.0.0';
$uri = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : ''; $uri = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '';
error_log("[{$now}] {$server} {$remote} {$uri}\r\n{$info}\r\n", 3, $destination); return error_log("[{$now}] {$server} {$remote} {$uri}\r\n{$info}\r\n", 3, $destination);
return true;
} }
} }

View File

@@ -65,7 +65,7 @@ class routeTest extends \PHPUnit_Framework_TestCase
public function testRouteMap() public function testRouteMap()
{ {
Route::map('hello', 'index/hello'); Route::map('hello', 'index/hello');
//$this->assertEquals('index/hello',Route::map('hello')); $this->assertEquals('index/hello', Route::map('hello'));
$this->assertEquals(['type' => 'module', 'module' => ['index', 'hello', null]], Route::check('hello')); $this->assertEquals(['type' => 'module', 'module' => ['index', 'hello', null]], Route::check('hello'));
} }