php学习笔记 [预定义数组(超全局数组)]

php学习笔记 预定义数组(超全局数组),需要的朋友可以参考下。

  1.  
  2.  
  3. /* 预定义数组: 
  4. * 自动全局变量—超全局数组   
  5.  
  6. * 1.包含了来自WEB服务器,客户端,运行环境和用户输入的数据   
  7. * 2.这些数组比较特别   
  8. * 3.全局范围内自动生效,都可以直接使用这些数组   
  9. * 4.用户不能自定义这些数组,但这些数组的操作方式和自己定义的数组操作的方式一样   
  10. * 5.在函数中直接可以使用这些数组   
  11.  
  12. * $_GET //经由URL请求提交至脚本的变量   
  13. * $_POST //经由HTTP POST 方法提交到脚本的变量   
  14. * $_REQUEST //经由GET , POST和COOKIE机制提交 到脚本的变量   
  15. * $_FILES //经由http post方法文件上传而提交至脚本的变量   
  16. * $_COOKIE   
  17. * $_SESSION   
  18. * $_ENV //执行环境提交至脚本的变量   
  19. * $_SERVER //变量由WEB服务器设定的,或直接和当前脚本的执行环境相关联   
  20. * $GLOBALS //只要是当前脚本有效的变量都在这里,数组的键名为全局脚本的名称   
  21.  
  22.  
  23. */   
  24. //超全局数组在函数内部可以直接调用   
  25. $arr=array(10,20);//一般数组   
  26. $_GET=array(50,90);//超全局数组   
  27. function demo(){   
  28. global $arr;//调用全局变量要先包含   
  29. print_r($arr);   
  30. print_r($_GET);//直接调用超全局数组不用包含   
  31. }   
  32. ?>   
  33.    
  34.  
  35. //直接把传的值当变量用,当php.ini配置文件中register_global=on时有用。   
  36. echo $username."
    "
    ;   
  37. echo $email."
    "
    ;   
  38. echo $page."
    "
    ;   
  39. //最稳定的取值方法   
  40. echo $_GET["username"]."
    "
    ;   
  41. echo $_GET["email"]."
    "
    ;   
  42. echo $_GET["page"]."
    "
    ;   
  43. ?>   
  44. "demo.php?username=zhangsan&email=aaa@bbb.com&page=45">this is a $_GET test   
  45.    
  46. <form action="demo.php" method="post">   </form action=
  47. username:<input type=<form action="text" name="uname" /> 
       
    </form action=</input type=
  48. password:<input type=<input type=<form action="password" name="pass" /> 
       
    </form action=</input type=</input type=
  49. <input type=<input type=<input type=<form action="submit" value="login" /> 
       
    </form action=</input type=</input type=</input type=
  50.    
  51.  
  52. print_r($_GET);//不能接收到   
  53. print_r($_POST);//这样才能接收到   
  54. ?>   
  55.  
  56. //$_ENV的使用   
  57. echo'
    ';   	
    • print_r($_ENV);   
      • echo'
      • ';   
      • //显示当前环境   
      • // 也可以单个遍历   
      • ?>   
      •  
      • //利用$GLOBALS超全局数组在函数内部调用全局变量   
      • $a=100;   
      • $b=200;   
      • $c=300;   
      • function demo()   
      • {   
      • //直接调用全局变量   
      • echo $GLOBALS["a"]."
        "
        ;   
      • echo $GLOABLS["b"]."
        "
        ;   
      • echo $GLOABLS["c"]."
        "
        ;   
      • }   
      • ?>  
波比源码 – 精品源码模版分享 | www.bobi11.com
1. 本站所有资源来源于用户上传和网络,如有侵权请邮件联系站长!
2. 分享目的仅供大家学习和交流,您必须在下载后24小时内删除!
3. 不得使用于非法商业用途,不得违反国家法律。否则后果自负!
4. 本站提供的源码、模板、插件等等其他资源,都不包含技术服务请大家谅解!
5. 如有链接无法下载、失效或广告,请联系管理员处理!
6. 本站资源售价只是赞助,收取费用仅维持本站的日常运营所需!
7. 本站源码并不保证全部能正常使用,仅供有技术基础的人学习研究,请谨慎下载
8. 如遇到加密压缩包,请使用WINRAR解压,如遇到无法解压的请联系管理员!

波比源码 » php学习笔记 [预定义数组(超全局数组)]

106 评论

  1. buy dutasteride without prescription dutasteride oral buy zofran 4mg

  2. tadalafil 10mg en ligne viagra prix sildenafil 25mg sans ordonnance

  3. order modafinil 100mg generic Buy cheap cialis acetazolamide over the counter

  4. order olmesartan 20mg generic order calan sale buy diamox 250 mg sale

  5. purchasing cialis on the internet Approved cialis sildenafil 100mg over the counter

  6. order cialis online cheap amantadine 100 mg uk purchase symmetrel without prescription

  7. naltrexone 50mg cost order abilify order abilify 20mg for sale

  8. isotretinoin 40mg oral prednisone online buy generic prednisone 5mg

  9. chloroquine for sale olumiant 4mg ca purchase olumiant online cheap

  10. order levitra 20mg online medrol order medrol 8mg oral

  11. triamcinolone 10mg brand claritin price order clarinex without prescription

  12. buy flomax 0.2mg pills flomax online buy purchase aldactone generic

  13. tadalafil 10mg ca cost tadalafil purchase viagra for sale

  14. order proventil brand cipro buy ciprofloxacin 1000mg pills

  15. order actos 15mg for sale viagra cost viagra without prescription

  16. essay helper online arava 20mg drug buy sulfasalazine 500mg pills

  17. buy acetazolamide without prescription generic isosorbide azathioprine without prescription

  18. carvedilol 6.25mg cheap buy elavil generic order generic amitriptyline 10mg

  19. order doxycycline 100mg generic cost aralen methylprednisolone 16 mg online

  20. order metformin 500mg pills calan 120mg ca buy tamoxifen 20mg for sale

  21. purchase modafinil for sale cost stromectol 6mg order phenergan without prescription

  22. order prednisolone online buy lasix 100mg buy lasix online cheap

  23. паспорт ес румыния

  24. order dutasteride online xenical us generic xenical 120mg

发表评论

Hi, 如果你对这款模板有疑问,可以跟我联系哦!

联系站长
赞助VIP 享更多特权,建议使用 QQ 登录
喜欢我嘛?喜欢就按“ctrl+D”收藏我吧!♡