WpOrg\Requests\Transport
Fsockopen::format_get()
Format a URL given GET data
Метод класса: Fsockopen{}
Хуков нет.
Возвращает
Строку
. URL with data
Использование
$result = Fsockopen::format_get( $url_parts, $data );
- $url_parts(массив) (обязательный)
- Array of URL parts as received from https://www.php.net/parse_url
- $data(массив|объект) (обязательный)
- Data to build query using, see https://www.php.net/http_build_query
Код Fsockopen::format_get() Fsockopen::format get WP 6.6.2
private static function format_get($url_parts, $data) { if (!empty($data)) { if (empty($url_parts['query'])) { $url_parts['query'] = ''; } $url_parts['query'] .= '&' . http_build_query($data, '', '&'); $url_parts['query'] = trim($url_parts['query'], '&'); } if (isset($url_parts['path'])) { if (isset($url_parts['query'])) { $get = $url_parts['path'] . '?' . $url_parts['query']; } else { $get = $url_parts['path']; } } else { $get = '/'; } return $get; }