Blogger Information
Blog 41
fans 2
comment 0
visits 29227
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
php之请求api数据与composer
月光下,遗忘黑暗
Original
752 people have browsed it

api请求数据

  1. <?php
  2. $url = 'http://v.juhe.cn/jztk/query?';
  3. $key = 'd2c85368186b5bcc9a0d3e4f6ba4fb6a';
  4. $subject = 1;
  5. $model = 'c1';
  6. $query = http_build_query(['key'=>$key,'subject'=>$subject,'model'=>$model]);
  7. //获取一个初始化句柄
  8. $ch = curl_init();
  9. //设置curl的完整地址
  10. curl_setopt($ch,CURLOPT_URL,$url.$query);
  11. //设置请求类型
  12. curl_setopt($ch,CURLOPT_HTTPGET,true);
  13. //去掉请求头
  14. curl_setopt($ch,CURLOPT_HEADER,false);
  15. //默认浏览器输出,修改成只返回不输出
  16. curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
  17. //获取数据
  18. $apiData = curl_exec($ch);
  19. //关掉句柄
  20. curl_close($ch);
  21. print_r(json_decode(file_get_contents($query),true));
  22. ?>

效果

composer常用命令

  1. #composer升级
  2. composer selfupdate
  3. #查看 Composer 的全局配置信息
  4. composer config -g --list
  5. # 推荐使用阿里云 Composer 全量镜像
  6. composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/

mvc pathinfo 路由映射是怎么实现的

我们的路由机制就是根据url,寻找到对应的controller,和action,然后由action进行具体的业务逻辑处理。

Correcting teacher:灭绝师太灭绝师太

Correction status:qualified

Teacher's comments:mvc pathinfo 路由映射最好用代码演绎一遍哦
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post