|
|
@@ -116,19 +116,12 @@ class Request extends \think\Request
|
|
|
*/
|
|
|
public function replaceWord($farr, $str)
|
|
|
{
|
|
|
- file_put_contents(__DIR__ . '/../debug_replaceWord.log', "Input: " . var_export($str, true) . "\n", FILE_APPEND);
|
|
|
- $url = parse_url($str);
|
|
|
- file_put_contents(__DIR__ . '/../debug_replaceWord.log', "parse_url: " . var_export($url, true) . "\n", FILE_APPEND);
|
|
|
- if ($url && isset($url['host']) && $url['host'] != '') {
|
|
|
- if (!isset($url['scheme'])) {
|
|
|
- $url['scheme'] = 'http';
|
|
|
- }
|
|
|
- $path = isset($url['path']) ? $url['path'] : '';
|
|
|
- $str = $url['scheme'] . '://' . $url['host'] . preg_replace($farr, '', $path);
|
|
|
+ if (parse_url($str, PHP_URL_HOST)) {
|
|
|
+ $url = parse_url($str);
|
|
|
+ $str = $url['scheme'] . '://' . $url['host'] . preg_replace($farr, '', $url['path']);
|
|
|
} else {
|
|
|
$str = preg_replace($farr, '', $str);
|
|
|
}
|
|
|
- file_put_contents(__DIR__ . '/../debug_replaceWord.log', "Output: " . var_export($str, true) . "\n\n", FILE_APPEND);
|
|
|
return $str;
|
|
|
}
|
|
|
|