查找
1 2 3 4
| foreach($post as $k => $v) { $data['findpattern'][$k] = $v['findpattern']; $data['replace'][$k] = $v['replacement']; }
|
改成
1 2 3 4 5 6 7 8 9
| foreach ($post as $k => $v) { if (substr($v['findpattern'], 0, 1) != '/' || substr($v['findpattern'], -3) != '/is') { $v['findpattern'] = '/' . preg_quote($v['findpattern'], '/') . '/is'; } $data['findpattern'][$k] = $v['findpattern']; $data['replace'][$k] = $v['replacement']; }
|
查找
1
| $UC_API = $post['UC_API'];
|
改成
1 2 3 4 5 6 7 8
| $UC_API = ''; if ($post['UC_API']) { $UC_API = str_replace(array('\'', '"', '\\', "\0", "\n", "\r"), '', $post['UC_API']); unset($post['UC_API']); }
|