Skip to content
This repository was archived by the owner on Jan 4, 2020. It is now read-only.

Commit f31631e

Browse files
committed
Merge branch 'master' of https://github.com/top-think/thinkphp
2 parents 1dd05ed + 5036e0b commit f31631e

3 files changed

Lines changed: 20 additions & 22 deletions

File tree

ThinkPHP/Common/functions.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -332,16 +332,16 @@ function I($name, $default = '', $filter = null, $datas = null)
332332
break;
333333
case 'param':
334334
switch ($_SERVER['REQUEST_METHOD']) {
335-
case 'POST':
335+
case 'POST':
336336
$input = $_POST;
337337
break;
338-
case 'PUT':
338+
case 'PUT':
339339
if (is_null($_PUT)) {
340340
parse_str(file_get_contents('php://input'), $_PUT);
341341
}
342342
$input = $_PUT;
343343
break;
344-
default:
344+
default:
345345
$input = $_GET;
346346
}
347347
break;
@@ -419,19 +419,19 @@ function I($name, $default = '', $filter = null, $datas = null)
419419
}
420420
if (!empty($type)) {
421421
switch (strtolower($type)) {
422-
case 'a': // 数组
422+
case 'a': // 数组
423423
$data = (array) $data;
424424
break;
425-
case 'd': // 数字
425+
case 'd': // 数字
426426
$data = (int) $data;
427427
break;
428-
case 'f': // 浮点
428+
case 'f': // 浮点
429429
$data = (float) $data;
430430
break;
431-
case 'b': // 布尔
431+
case 'b': // 布尔
432432
$data = (boolean) $data;
433433
break;
434-
case 's':// 字符串
434+
case 's': // 字符串
435435
default:
436436
$data = (string) $data;
437437
}
@@ -1144,7 +1144,7 @@ function U($url = '', $vars = '', $suffix = true, $domain = false)
11441144
}
11451145
}
11461146
}
1147-
if (isset($anchor)) {
1147+
if (!empty($anchor)) {
11481148
$url .= '#' . $anchor;
11491149
}
11501150
if ($domain) {

ThinkPHP/Library/Think/Route.class.php

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -188,28 +188,31 @@ public static function reverse($path, &$vars, $depr, $suffix = true)
188188
// 匹配成功
189189
if (!empty($flag)) {
190190
foreach (array_keys($array) as $key) {
191+
$array[$key] = urlencode($array[$key]);
191192
unset($vars[$key]);
192193
}
193194
return implode($depr, $array);
194195
}
195196
} else {
196197
// 正则路由
197198
$keys = !empty($args) ? array_keys($args) : array_keys($vars);
198-
$str = preg_replace_callback('/\(.+\)/', function ($match) use (&$vars, &$keys) {
199+
$temp_vars = $vars;
200+
$str = preg_replace_callback('/\(.*?\)/', function ($match) use (&$temp_vars, &$keys) {
199201
$k = array_shift($keys);
200-
return isset($vars[$k]) ? $vars[$k] : '';
202+
$re_var = '';
203+
if(isset($temp_vars[$k]))
204+
{
205+
$re_var = $temp_vars[$k];
206+
unset($temp_vars[$k]);
207+
}
208+
return urlencode($re_var);
201209
}, $rule);
202210
$str = substr($str, 1, -1);
203211
$str = rtrim(ltrim($str, '^'), '$');
204212
$str = str_replace('\\', '', $str);
205213
if (preg_match($rule, $str, $matches)) {
206214
// 匹配成功
207-
if ($args) {
208-
$keys = array_keys($args);
209-
}
210-
foreach ($keys as $key) {
211-
unset($vars[$key]);
212-
}
215+
$vars = $temp_vars;
213216
return str_replace('/', $depr, $str);
214217
}
215218
}

ThinkPHP/Tpl/think_exception.tpl

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
<?php
2-
if(C('LAYOUT_ON')) {
3-
echo '{__NOLAYOUT__}';
4-
}
5-
?>
61
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
72
<html xmlns="http://www.w3.org/1999/xhtml"><head>
83
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">

0 commit comments

Comments
 (0)