Skip to content

Commit e5523ea

Browse files
committed
细节调整
1 parent 214e08d commit e5523ea

2 files changed

Lines changed: 8 additions & 5 deletions

File tree

‎inc/config.php‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@
6969
$db = new medoo(array(
7070
'database_type' => 'mysql',
7171
'database_name' => 'hoorayos',
72+
'server' => 'localhost',
73+
'port' => 3306,
7274
'username' => 'root',
7375
'password' => '',
7476
'charset' => 'utf8',

‎inc/functions.php‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,15 @@ function authcode($string, $operation = 'DECODE', $key = '', $expiry = 0) {
7373
return $keyc.str_replace('=', '', base64_encode($result));
7474
}
7575
}
76-
function daddslashes($string, $force = 0, $strip = FALSE) {
77-
if(!get_magic_quotes_gpc() || $force) {
78-
if(is_array($string)) {
76+
function daddslashes($string, $force = 0, $strip = FALSE){
77+
//字符串或数组,是否强制,是否去除
78+
if(!MAGIC_QUOTES_GPC || $force){
79+
if(is_array($string)){
7980
//如果其为一个数组则循环执行此函数
80-
foreach($string as $key => $val) {
81+
foreach($string as $key => $val){
8182
$string[$key] = daddslashes($val, $force, $strip);
8283
}
83-
} else {
84+
}else{
8485
//下面是一个三元操作符,如果$strip为true则执行stripslashes去掉反斜线字符,再执行addslashes
8586
//这里为什么要将$string先去掉反斜线再进行转义呢,因为有的时候$string有可能有两个反斜线,stripslashes是将多余的反斜线过滤掉
8687
$string = addslashes($strip ? stripslashes($string) : $string);

0 commit comments

Comments
 (0)