zoukankan      html  css  js  c++  java
  • TP5.1:request请求对象(使用四种方式获取)

      准备:

      在index/controller下创建一个名为requests.php的文件(注意:不要起名为request,因为它是关键字,不被允许起名

      动态方法和静态方法的区别:

      静态方法:public  static  function  test(){}

      动态方法:;public  function  test(){}

      可以看出,他们的区别就是一个是静态方法,一个是普通方法。

      动态方法使用请求

        

         通过url访问:localhost/tp5的框架目录/thinkpublic//index.php/index/requests/request?name='小仓鼠'&age=18

      

       通过静态代理使用

      

      输出结果:

      

      通过依赖注入使用请求

      

      结果:

      通过Controller类中封装好的属性进行使用

        

        结果:

      以上

      END

      

      

  • 相关阅读:
    Vue项目搭建及原理三
    Vue项目搭建及原理一
    JS Cookie丢失问题
    1027 Colors in Mars
    1028 List Sorting
    1029 Median
    1030 Travel Plan
    1031 Hello World for U
    1032 Sharing
    1033 To Fill or Not to Fill
  • 原文地址:https://www.cnblogs.com/ianlab/p/14807220.html
Copyright © 2011-2022 走看看