本文整理匯總了PHP中response::show方法的典型用法代碼示例。如果您正苦於以下問題:PHP response::show方法的具體用法?PHP response::show怎麽用?PHP response::show使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類response
的用法示例。
在下文中一共展示了response::show方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: updateBusinessInfor
/**
* @param $businessId
* @param $shopfrontPic
* @param $licencePic
* @throws Exception
*/
function updateBusinessInfor($businessId, $shopfrontPic, $licencePic)
{
$businessName = $_REQUEST['$businessName'];
$startTime = $_REQUEST['$startTime'];
$endTime = $_REQUEST['$endTime'];
$lon = $_REQUEST['$lon'];
$lat = $_REQUEST['$lat'];
$mobilePhone = $_REQUEST['$mobilePhone'];
$sortF = $_REQUEST['$sortF'];
$sortS = $_REQUEST['$sortS'];
$privileges = $_REQUEST['$privileges'];
$description = $_REQUEST['$description'];
$serviceindex = $_REQUEST['$serviceindex'];
$province = $_REQUEST['$province'];
$city = $_REQUEST['$city'];
$addresDetail = $_REQUEST['$addresDetail'];
$fixTelephone = $_REQUEST['$fixTelephone'];
// 字符必須添加'',數字不必添加
$sqlUpdate = "UPDATE\n `business`\n SET\n `name` = '{$businessName}',\n `sortF` = {$sortF},\n `sortS` = {$sortS},\n `privileges` = '{$privileges}',\n `picUrl` = '{$shopfrontPic}',\n `description` = '{$description}',\n `businessSTime` = {$startTime},\n `businessETime` = {$endTime},\n `licensePicUrl` = '{$licencePic}',\n `mobilePhone` = '{$mobilePhone}',\n `serviceindex` = {$serviceindex},\n `longitude` = {$lon},\n `latitude` = {$lat},\n `province` = {$province},\n `city` = {$city},\n `addresDetail` = '{$addresDetail}',\n `fixTelephone` = '{$fixTelephone}'\n WHERE\n `business`.`id` = {$businessId}";
$connect = db::getInstance()->connect();
$result = mysqli_query($connect, $sqlUpdate);
if ($result) {
echo '更新基本數據成功';
} else {
echo response::show(201, '更新基本數據失敗');
}
}
示例2: storeLicenceImage
public static function storeLicenceImage($imageName, $imageData)
{
if ($imageData == '') {
echo 'licencePic圖片為空';
} else {
$fullImageName = cLicencePath . $imageName;
if (self::storeImage($fullImageName, $imageData)) {
echo 'licencePic圖片保存成功';
return cPicUrlHeader . $fullImageName;
} else {
echo response::show(201, 'licencePic圖片保存失敗');
}
}
}
示例3: header
header("Content-Type: text/html; charset=utf-8");
/**
* Created by PhpStorm.
* User: Administrator
* Date: 2015/9/16
* Time: 20:09
*/
const cPicUrlHeader = 'http://192.168.199.104:8090/images/';
// 返回給客戶端圖片url的頭部
const cPicStorePath = '/Users/wsk/pb_cs/www/uploadImages/';
// 客戶端上傳的圖片在服務器中存放的路徑
require_once './tools/db.php';
require_once './tools/response.php';
$img = base64_decode($_REQUEST['picStr']);
$picName = time() . '.jpg';
// 1、將圖片的url,對應的商戶id,保存到數據庫中
$picUrl = cPicUrlHeader . $picName;
$connect = db::getInstance()->connect();
$sql = 'SELECT pwd FROM `account` WHERE `phone` = ' . $phone;
$result = mysqli_query($sql, $connect);
$row = mysqli_fetch_object($result);
// 2、將圖片保存到指定路徑下麵
$picStorePath = cPicStorePath . $picName;
$fileLength = file_put_contents($picStorePath, $img);
// 返回值為圖片的長度
if ($fileLength > 0) {
echo response::show(200, '上傳圖片成功');
} else {
echo response::show(201, '上傳圖片失敗');
}
示例4: header
<?php
header("Content-Type: text/html; charset=utf-8");
require_once './tools/db.php';
require_once './tools/response.php';
// php5.5以後mysql全部替換成mysqli或者使用下麵兩行的任一行
// error_reporting(E_ALL ^ E_DEPRECATED);
// error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);
/**
* Created by PhpStorm.
* User: new1
* Date: 2015/9/13
* Time: 16:46
*/
$connect = db::getInstance()->connect();
$sql = 'select * from account';
$result = mysqli_query($sql, $connect);
echo mysqli_num_rows($result) . ' 行 ' . mysqli_num_fields($result) . ' 列 ' . "<br />" . "<br />" . "<br />";
echo '結果' . $result . '結果' . "<br />";
$resList = array();
while ($row = mysqli_fetch_object($result)) {
$model = array('phone' => &$row->phone, 'pwd' => &$row->pwd);
$resList[] = $model;
// echo $row->id.'手機號碼:'. $row->phone. ' 密碼:'.$row->password."<br />";
}
echo response::show(200, '成功', $resList);
示例5: header
/**
* Created by PhpStorm.
* User: Administrator
* Date: 2015/9/11
* Time: 22:08
*/
//$a = isset($GLOBALS["HTTP_RAW_POST_DATA"]) ? $GLOBALS["HTTP_RAW_POST_DATA"] : "" ;
//$a = $GLOBALS["HTTP_RAW_POST_DATA"];
// $phone = 'zhxxxxxang';
// $password = '11uuuu1';
//$json = json_decode($a,true);
//$json = file_get_contents('php://input');
//$json = json_decode($json);
//echo $json[0]->app_slug;
header("Content-Type: text/html; charset=utf-8");
require_once './tools/db.php';
require_once './tools/response.php';
$phone = $_REQUEST['phone'];
// 獲取客戶端傳遞過來的用戶名
$pwd = $_REQUEST['pwd'];
// 獲取客戶端傳遞過來密碼
$connect = db::getInstance()->connect();
$sql = 'SELECT pwd FROM `account` WHERE `phone` = ' . $phone;
$result = mysqli_query($sql, $connect);
$row = mysqli_fetch_object($result);
if ($row->pwd == $pwd) {
echo response::show(200, '登陸成功');
} else {
echo response::show(205, '登陸失敗');
}
示例6: base64_decode
// ../這個是返回上一級
require_once '../../tools/db.php';
require_once '../../tools/response.php';
$img = base64_decode($_POST['picStr']);
// 圖片的內容
$picName = $_POST['businessID'] . '_' . time() . '.jpg';
// 圖片的名字
// 1、將圖片的url,對應的商戶id,保存到數據庫中
$businessID = $_POST['businessID'];
// 商戶id
$categoryID = $_POST['categoryID'];
// 菜品分類id
$picUrl = 'http://192.168.199.104:8090/images/' . $picName;
// 圖片的下載url
$dishName = $_POST['dishName'];
// 菜品名字
$price = $_POST['price'];
// 菜品價格
$connect = db::getInstance()->connect();
$sql = "SELECT * FROM dish WHERE businessID = " . $businessID . " AND categoryID = " . $categoryID . " AND dishName = " . "'" . $dishName . "'";
$result = mysqli_query($sql, $connect);
if (mysqli_num_rows($result) > 0) {
echo response::show(206, '該菜品已經被登記');
} else {
$sql = "INSERT INTO `test`.`dish` (`businessID`, `categoryID`, `picUrl`, `dishName`, `price`) VALUES (" . $businessID . "," . $categoryID . "," . "'" . $picUrl . "'" . "," . "'" . $dishName . "'" . "," . $price . ")";
if (mysqli_query($sql, $connect)) {
echo response::show(200, '菜品登記注冊成功');
} else {
echo response::show(203, '菜品登記失敗' . $sql);
}
}
示例7: header
<?php
header("Content-Type: text/html; charset=utf-8");
require_once './tools/db.php';
require_once './tools/response.php';
$phone = $_POST['phone'];
// 獲取客戶端傳遞過來的用戶名
$pwd = $_POST['pwd'];
// 獲取客戶端傳遞過來密碼
if ($pwd == '') {
echo response::show(201, '密碼不能為空');
} else {
if ($phone == '') {
echo response::show(202, '手機號碼不能為空');
} else {
$connect = db::getInstance()->connect();
$sql = 'SELECT * FROM `account` WHERE `phone` = ' . $phone;
$result = mysqli_query($sql, $connect);
if (mysqli_num_rows($result) > 0) {
echo response::show(204, '該手機號已經被注冊');
} else {
$sql = 'INSERT INTO `account`(`id`, `phone`, `pwd`) VALUES (NULL, ' . $phone . ',' . $pwd . ')';
if (mysqli_query($sql, $connect)) {
echo response::show(200, '注冊成功');
} else {
echo response::show(203, '注冊失敗');
}
}
}
}