Home  >  Article  >  Backend Development  >  【PHP】PHP第一天

【PHP】PHP第一天

WBOY
WBOYOriginal
2016-06-23 14:36:571337browse

note:

PHP接收参数的几种方式

      PHP5在默认的情况下接收参数是需要使用
     $_GET['value'];
     $_POST['value'];

     还可以在PHP.ini 文件中的
      将register_globals = Off
      改register_globals = on

     可以直接使用,$value的值
===========================================
while (list($name, $value) = each($HTTP_POST_VARS)) {

    echo "$name = $value
\n";

each() 经常和 list() 结合使用来遍历数组,例如:

例子 2. 用 each() 遍历数组

$fruit = array('a' => 'apple', 'b' => 'banana', 'c' => 'cranberry');
reset ($fruit);
while (list ($key, $val) = each ($fruit)) {
    echo "$key => $val\n";
}
/* Outputs:

a => apple
b => banana
c => cranberry

*/
?>

在执行 each() 之后,数组指针将停留在数组中的下一个单元或者当碰到数组结尾时停留在最后一个单元。如果要再用 each 遍历数组,必须使用 reset()。


===========================================
PHP100中文网:http://www.php100.com/
PHP10日通视频教程:http://www.php100.com/html/phpnews/PHPxinwen/2009/0408/14.html
Statement:
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