Home > Backend Development > PHP Tutorial > 关于$_SERVER['argv']参数问题

关于$_SERVER['argv']参数问题

WBOY
Release: 2016-06-06 20:17:04
Original
1836 people have browsed it

$a= intval($_SERVER['argv'] [2]);

$_SERVER['argv'] [2] 这个地方 他为什么后面要在个[2] 这是什么意思

回复内容:

$a= intval($_SERVER['argv'] [2]);

$_SERVER['argv'] [2] 这个地方 他为什么后面要在个[2] 这是什么意思

PHP会在脚本运行时根据参数创建两个特殊的变量,$argc是一个整数,表示参数个数,$argv是一个数组变量,包含每个参数的值,它的第一个元素一直是PHP脚本的名字,你传递给脚本的第三个参数即 $_SERVER['argv'] [2]

你打印出来$_SERVER['argv'],是个数组。
[2]是数组的元素下标。

Related labels:
php
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template