PHP-手册阅读笔记

1.第一次遇到$_ENV为空数组的情况, 原来是PHP.INI中variables_order为'GPCS'(表示系统在定义PHP预定义变量时的顺序是GET,POST,COOKIES,SERVER,只要在'GPCS'后加上'E'就可以了)

2.当在命令行下获取$_SERVER['HOST_NAME']时为空, 可以用$_ENV['HOSTNAME'];

3.iconv与mb_convert_encoding区别: mb_convert_encoding需要开启mbstring扩展库, iconv转换出错时可以用//IGNORE

4.http://localhost/index.php?a //注意此处a无值

<pre>
<?php
    print_r($_GET);
    if($_GET["a"] === "") echo "a is an empty string
"; #断言成功
    if($_GET["a"] === false) echo "a is false
";
    if($_GET["a"] === null) echo "a is null
";
    if(isset($_GET["a"])) echo "a is set
"; #断言成功
    if(!empty($_GET["a"])) echo "a is not empty";
?>
</pre>

结果得到

  Array (

    [a] =>

  )

  a is an empty string

  a is set

5.

原文地址:https://www.cnblogs.com/JohnABC/p/3469697.html