php获取url参数程序代码总结
Jun 13, 2016 am 11:32 AMparse_url函数
我们先来了解一下parse_url函数,官方解决
说明
mixed parse_url ( string $url [, int $component = -1 ] )
本函数解析一个 URL 并返回一个关联数组,包含在 URL 中出现的各种组成部分。
本函数不是用来验证给定 URL 的合法性的,只是将其分解为下面列出的部分。不完整的 URL 也被接受, parse_url() 会尝试尽量正确地将其解析。
要解析的 URL。无效字符将使用 _ 来替换。
实例
代码如下 | |
$url = "http://www.45it.net/welcome/"; $parts = parse_url($url); print_r($parts);
|
也可以自己去写一个算法!如下
代码如下 | |
|
调用方法
代码如下 | |
$arr = getParams(); |
结果
结果: Array ( [_p] => index [_a] => show [x] => 12 [y] => 23 )

Hot Article

Hot tools Tags

Hot Article

Hot Article Tags

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian

How To Set Up Visual Studio Code (VS Code) for PHP Development
