-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
1,021 additions
and
197 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file modified
BIN
-10 Bytes
(100%)
.sass-cache/8520709948cf6a5d821e937106bb197ccb969729/index.scssc
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<?php | ||
class Goods{ | ||
public $goodsId; | ||
public $goodsName; | ||
public $goodsPrice; | ||
public $goodsImg; | ||
} | ||
|
||
$con = new mysqli('127.0.0.1','root','','dome'); | ||
$con->query("set names utf8"); //设置编码为utf8 显示中文 | ||
$sql = 'select * from goods'; | ||
$res = $con->query($sql); | ||
$arr = array(); | ||
if(!$con->connect_error){ | ||
if($res->num_rows > 0){ | ||
while($row = $res->fetch_assoc()){ | ||
$goods = new Goods(); | ||
$goods->goodsId = $row["gid"]; | ||
$goods->goodsName = $row["goodsname"]; | ||
$goods->goodsPrice = $row["goodsprice"]; | ||
$goods->goodsImg = $row["goodsImg"]; | ||
|
||
array_push($arr, $goods); | ||
} | ||
|
||
//返回json字符串 | ||
}else { | ||
array_push($arr, "没有商品"); | ||
} | ||
}else{ | ||
array_push($arr, "连接数据库失败"); | ||
} | ||
|
||
print_r($arr); | ||
|
||
//判断是否是jsonp的请求 | ||
//isset(var) 判断变量是否被定义 | ||
if(isset($_REQUEST['callback'])){ | ||
// 表示是一个jsonp的请求 | ||
//找到callback 的函数名称 | ||
$callback = $_REQUEST['callback']; | ||
//调用callback的函数 | ||
$str = json_encode($arr); | ||
print_r( $callback."('$str')"); | ||
}else{ | ||
array_push($arr, "连接数据库失败"); | ||
$str = json_encode($arr); | ||
print_r( $str ); | ||
|
||
} | ||
|
||
|
||
// print_r($str) | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[{"goodsId":"10001","goodsName":"\u5546\u54c11","goodsPrice":"100001","goodsImg":"http:\/\/localhost\/1611\/day22\/images\/1.jpg"},{"goodsId":"10002","goodsName":"\u5546\u54c12","goodsPrice":"100001","goodsImg":"http:\/\/localhost\/1611\/day22\/images\/2.jpg"},{"goodsId":"10004","goodsName":"\u5546\u54c13","goodsPrice":"100001","goodsImg":"http:\/\/localhost\/1611\/day22\/images\/3.jpg"},{"goodsId":"10005","goodsName":"\u5546\u54c14","goodsPrice":"100001","goodsImg":"http:\/\/localhost\/1611\/day22\/images\/4.jpg"},{"goodsId":"10006","goodsName":"\u5546\u54c15","goodsPrice":"100001","goodsImg":"http:\/\/localhost\/1611\/day22\/images\/5.jpg"}] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"name":"jk", | ||
"data":[], | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.