php简单模拟后台接口创建类
来源:互联网 发布:免费弄lol网吧特权mac 编辑:程序博客网 时间:2024/05/19 01:11
<?php/** * Created by PhpStorm. * User: Administrator * Date: 2016/12/19 * Time: 11:16 */class Goods{ private $id,$name,$price,$image; function getId(){ return $this -> id; } function getName(){ return $this -> name; } function getPrice(){ return $this -> price; } function getImage(){ return $this -> image; } function setId($id){ $this -> id = $id; } function setName($name){ $this -> name = $name; } function setPrice($price){ $this -> price = $price; } function setImage($image){ $this -> image = $image; } function __construct($id,$name,$price,$image){ $this -> id = $id; $this -> name = $name; $this -> price = $price; $this ->image = $image; } function toArray(){ $a = array( "id" => $this -> id, "name" => $this -> name, "price" => $this -> price, "image" => $this -> image ); return $a; }}$g1 = new Goods("1","外星人电脑","¥2345","images/1.jpg");$g2 = new Goods("2","唇彩","¥45","images/2.jpg");$g3 = new Goods("3","酷睿","¥2345","images/3.jpg");$g4 = new Goods("4","面膜","¥45","images/4.jpg");$g5 = new Goods("5","韩束","¥45","images/5.jpg");$g6 = new Goods("6","手机","¥45","images/6.jpg");$goodlist = array($g1 -> toArray(),$g2 -> toArray(),$g3 -> toArray(),$g4 -> toArray(),$g5 -> toArray(),$g6 -> toArray());echo json_encode($goodlist);
0 0
- php简单模拟后台接口创建类
- Ajax请求PHP后台接口返回信息简单实例
- 微信小程序request请求后台接口php简单实例
- php-简单后台图书管理系统-数据库表的创建以及pdo方式数据库的封装工具类01
- PHP简单模拟多线程
- java后台模拟post接口上传
- php模拟请求接口CURL
- php简单的接口
- 简单的php登陆类及后台权限的控制
- java后台调用HttpURLConnection类模拟浏览器请求实例(可用于接口调用)
- java后台调用HttpURLConnection类模拟浏览器请求实例(可用于接口调用)
- java后台调用HttpURLConnection类模拟浏览器请求实例(可用于接口调用)
- java后台调用HttpURLConnection类模拟浏览器请求实例(可用于接口调用)
- Java后台调用HttpURLConnection类模拟浏览器请求实例(可用于接口调用)
- 表单提交与后台PHP如何接口?
- App微信支付 php后台接口
- php 简单创建图像
- SoapUI5.0创建WebService接口模拟服务端
- 由apple sample code "LazyTableImages"谈谈scrollView的两个代理方法
- 第12期《 蓄势待发 》1月刊
- 古尺神奇
- 构造函数之显式初始化与赋值
- 正则表达式中的/\\\\/四个反斜杠含义
- php简单模拟后台接口创建类
- BZOJ3926: [Zjoi2015]诸神眷顾的幻想乡 广义后缀自动机
- php中for循环嵌套问题 急,!!!
- 观《啊哈算法》,积累代码(c++实现)
- jetty 初涉——eclipse插件安装
- Struts文件上传
- OkHttpUtils的用法
- 往年总结,新年期望
- 直接拿来用!最火的Android开源项目(完结篇)