今天写小东西,有个需求,提取整个url的域名部分,以前写easyxss时用过,一个什么函数来着,懒得翻源码,随即google了一下,果然, 找到的都是查找关键字、截断字符串之类的做法。。。用得着那么麻烦么。。所以在此记录一下。 ?php//Wdot http://wdot.ccprin
今天写小东西,有个需求,提取整个url的域名部分,以前写easyxss时用过,一个什么函数来着,懒得翻源码,随即google了一下,果然, 找到的都是查找关键字、截断字符串之类的做法。。。用得着那么麻烦么。。所以在此记录一下。
<?php
//Wdot http://wdot.cc
print_r(parse_url('http://wdot.cc/Attack/90.html'));
?>运行结果:
Array
(
[scheme] => http
[host] => wdot.cc
[path] => /Attack/90.html
)函数说明:
微信小程序是一种轻量级的应用开发平台,由腾讯公司推出,主要应用于移动端,旨在提供便捷的用户体验,无需下载安装即可在微信内使用。本压缩包包含了丰富的源码资源,涵盖了多个领域的应用场景,下面将逐一介绍其中涉及的知识点。1. 图片展示:这部分源码可能涉及了微信小程序中的``组件的使用,用于显示图片,以及`wx.getSystemInfo`接口获取屏幕尺寸,实现图片的适配和响应式布局。可能还包括了图片懒加
0
parse_url
(PHP 4, PHP 5)
parse_url — Parse a URL and return its components
Description
mixed parse_url ( string $url [, int $component = -1 ] )
This function parses a URL and returns an associative array containing any of the various components of the URL that are present.
This function is not meant to validate the given URL, it only breaks it up into the above listed parts. Partial URLs are also accepted, parse_url() tries its best to parse them correctly.
Parameters
url
The URL to parse. Invalid characters are replaced by _.
component
Specify one of PHP_URL_SCHEME, PHP_URL_HOST, PHP_URL_PORT, PHP_URL_USER, PHP_URL_PASS, PHP_URL_PATH, PHP_URL_QUERY or PHP_URL_FRAGMENT to retrieve just a specific URL component as a string (except when PHP_URL_PORT is given, in which case the return value will be an integer).
Return Values
On seriously malformed URLs, parse_url() may return FALSE.
If the component parameter is omitted, an associative array is returned. At least one element will be present within the array. Potential keys within this array are:
If the component parameter is specified, parse_url() returns a string (or an integer, in the case of PHP_URL_PORT) instead of an array. If the requested component doesn't exist within the given URL, NULL will be returned.
原文地址:php提取URL中的域名部分, 感谢原作者分享。
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
C++高性能并发应用_C++如何开发性能关键应用
Java AI集成Deep Java Library_Java怎么集成AI模型部署
Golang后端API开发_Golang如何高效开发后端和API
Python异步并发改进_Python异步编程有哪些新改进
C++系统编程内存管理_C++系统编程怎么与Rust竞争内存安全
Java GraalVM原生镜像构建_Java怎么用GraalVM构建高效原生镜像
Python FastAPI异步API开发_Python怎么用FastAPI构建异步API
C++现代C++20/23/26特性_现代C++有哪些新标准特性如modules和coroutines
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号