本文整理汇总了PHP中response类的典型用法代码示例。如果您正苦于以下问题:PHP response类的具体用法?PHP response怎么用?PHP response使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了response类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: run
/**
* Returns some basic info about the current user.
*
* @param $params - ignored, filled for API concurrency.
* @return response array with username, id, fullname
*
*/
function run($params)
{
if (currentuser::getInstance() != null) {
$response = new response('Success');
$user = currentuser::getInstance();
$response->set('name', $user->fullname);
$response->set('user', $user->getUsername());
$response->set('id', $user->getID());
return $response;
} else {
return new error('Access denied', 403);
}
}
开发者ID:Br3nda,项目名称:medusa,代码行数:20,代码来源:wrms_user_whoAmI.php
示例2: fields
function fields()
{
$res = new response();
$db = $this->params["db"];
$table = $this->params["table"];
//query
$result = Doo::db()->fetchAll("SHOW COLUMNS IN {$table} IN {$db}");
foreach ($result as $row) {
$data[] = array('field' => $row["Field"], 'type' => $row["Type"], 'null' => $row['Null'], 'key' => $row['Key'], 'default' => $row['Default']);
}
$res->data = $data;
$res->success = true;
echo $res->to_json();
}
开发者ID:garv347,项目名称:swanhart-tools,代码行数:14,代码来源:SchemaRESTController.php
示例3: getProp
public function getProp()
{
$postCartId = input::get('catId');
try {
$userMdlProp = app::get("syscategory")->model('cat_rel_prop');
$propList = $userMdlProp->getList("*", array('cat_id' => $postCartId));
$pagedata = array();
foreach ($propList as $prop) {
// code...
$propId = $prop["prop_id"];
$propModel = app::get("syscategory")->model('prop_values');
$propValueList = $propModel->getList("*", array('prop_id' => $propId));
foreach ($propValueList as $propvalue) {
$pagedata[] = array("prop_value_id" => $propvalue["prop_value_id"], "prop_value" => $propvalue["prop_value"]);
}
$a = 1;
}
} catch (Exception $e) {
$msg = $e->getMessage();
return $this->splash('error', null, $msg);
} catch (\LogicException $e) {
$msg = $e->getMessage();
return $this->splash('error', null, $msg);
}
$ajaxdata = array('datas' => $pagedata);
return response::json($ajaxdata);
}
开发者ID:453111208,项目名称:bbc,代码行数:27,代码来源:goods.php
示例4: serveUserList
private function serveUserList()
{
$data = array('event' => 'userlist', 'data' => $this->clients);
response::all(json_encode($data), true);
$data['client'] = response::$current_socket_key;
response::me(json_encode($data));
}
开发者ID:soldair,项目名称:solumWebSocket,代码行数:7,代码来源:chat.php
示例5: check
public function check()
{
$this->params['app_id'] = $appid = isset($_POST['app_id']) ? $_POST['app_id'] : '';
$this->params['version_id'] = $versionid = isset($_POST['version_id']) ? $_POST['version_id'] : '';
$this->params['version_mini'] = $versionmini = isset($_POST['version_mini']) ? $_POST['version_mini'] : '';
$this->params['did'] = $did = isset($_POST['did']) ? $_POST['did'] : '';
$this->params['encrypt_did'] = $encryptdid = isset($_POST['encrypt_did']) ? $_POST['encrypt_did'] : '';
// 接口数据校验省略,实际使用时须加
if (!is_numeric($appid)) {
response::getEncode(300, 'params error', '');
exit;
}
// 判断APP是都要加密
$this->app = $this->getApp($appid);
if (!$this->app) {
response::getEncode(500, 'params error', '');
exit;
}
/*
if($encryptdid!=md5($did,$this->app['key'])){
response::getEncode(500,'md5 error','');
exit();
}
*/
}
开发者ID:tanhaipeng,项目名称:APP_API,代码行数:25,代码来源:Common.class.php
示例6: execTinyMce
protected function execTinyMce($prm=null) {
$search = 'js/tiny_mce/';
$request = request::get('request');
$pos = strpos($request, $search);
if ($pos === false)
exit;
$tmp = substr($request, $pos+strlen($search));
$file = file::nyroExists(array(
'name'=>'lib'.DS.'tinyMce'.DS.$tmp,
'realName'=>true,
'type'=>'other'
));
if (strpos($file, '.php') !== false) {
array_walk($_GET, create_function('&$v', '$v = urldecode($v);'));
$path = str_replace($tmp, '', $file);
ini_set('include_path', $path);
define('TINYMCEPATH', substr($path, 0, -1));
define('TINYMCECACHEPATH', substr(TMPROOT, 0, -1));
if (ob_get_length())
ob_clean();
include($file);
exit;
} else
response::getInstance()->showFile($file);
}
开发者ID:nyroDev,项目名称:nyroFwk,代码行数:25,代码来源:controller.class.php
示例7: afterRoute
/**
* compile and send the json response.
*/
public function afterRoute($f3, $params)
{
$version = (int) $f3->get('GET.version');
if (empty($version)) {
$version = $this->version;
}
if ($version !== $this->version) {
$this->failure(4999, 'Unknown API version requested.', 400);
}
if (empty($this->data['href'])) {
$data['href'] = $this->href();
}
$data = array('service' => 'API', 'api' => $version, 'time' => time()) + $this->data;
// if an OAuthError is set, return that instead of errors array
if (!empty($this->OAuthError)) {
$data['error'] = $this->OAuthError;
} else {
if (count($this->errors)) {
ksort($this->errors);
$data['errors'] = $this->errors;
}
}
$return = $f3->get('GET.return');
switch ($return) {
case 'xml':
$this->response->xml($data, $this->params);
break;
default:
case 'json':
$this->response->json($data, $this->params);
}
}
开发者ID:andydwilliams,项目名称:f3-boilerplate,代码行数:35,代码来源:Api.php
示例8: ajaxCouponData
public function ajaxCouponData()
{
$filter = input::get();
if (!$filter['pages']) {
$filter['pages'] = 1;
}
$pageSize = 10;
$params = array('page_no' => $pageSize * ($filter['pages'] - 1), 'page_size' => $pageSize, 'fields' => '*', 'user_id' => userAuth::id());
$couponListData = app::get('topm')->rpcCall('user.coupon.list', $params, 'buyer');
$count = $couponListData['count'];
$couponList = $couponListData['coupons'];
//处理翻页数据
$current = $filter['pages'] ? $filter['pages'] : 1;
$filter['pages'] = time();
if ($count > 0) {
$total = ceil($count / $pageSize);
}
$pagedata['pagers'] = array('link' => url::action('topm_ctl_member_coupon@couponList', $filter), 'current' => $current, 'total' => $total, 'token' => $filter['pages']);
$pagedata['couponList'] = $couponList;
$pagedata['count'] = $count;
$pagedata['action'] = 'topm_ctl_member_coupon@couponList';
if (input::get('json')) {
$data['html'] = view::make('topm/member/coupon/list.html', $pagedata)->render();
$data['pagers'] = $pagedata['pagers'];
$data['success'] = true;
return response::json($data);
exit;
}
return view::make('topm/member/coupon/list.html', $pagedata);
}
开发者ID:453111208,项目名称:bbc,代码行数:30,代码来源:coupon.php
示例9: 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, '更新基本数据失败');
}
}
开发者ID:nbhhcty,项目名称:appServer_Git,代码行数:33,代码来源:registration.php
示例10: toHtml
public function toHtml()
{
if ($this->cfg->useJs) {
$this->cfg->setInArray('html', 'class', $this->cfg->getInArray('html', 'class') . ' date');
$resp = response::getInstance();
$resp->addJs('jqueryui');
if (($lang = request::get('lang')) != 'en') {
$resp->addJs('i18n_ui.datepicker-' . $lang);
}
$jsPrmMin = $this->cfg->jsPrm;
$jsPrmMax = $this->cfg->jsPrm;
$minId = $this->makeId($this->name . '[0]');
$maxId = $this->makeId($this->name . '[1]');
$minDate = $this->dates['min']->getJs(null);
$maxDate = $this->dates['max']->getJs(null);
$jsPrmMin['onSelect'] = 'function(dateText) {$("#' . $maxId . '").datepicker("option", "minDate", $("#' . $minId . '").datepicker("getDate"));}';
if ($maxDate) {
$jsPrmMin['maxDate'] = $maxDate;
}
$jsPrmMax['onSelect'] = 'function(dateText) {$("#' . $minId . '").datepicker("option", "maxDate", $("#' . $maxId . '").datepicker("getDate"));}';
if ($minDate) {
$jsPrmMax['minDate'] = $minDate;
}
$resp->blockJquery('
$("#' . $minId . '").datepicker(' . utils::jsEncode($jsPrmMin) . ');
$("#' . $maxId . '").datepicker(' . utils::jsEncode($jsPrmMax) . ');
');
}
return parent::toHtml();
}
开发者ID:nyroDev,项目名称:nyroFwk,代码行数:30,代码来源:date.class.php
示例11: __construct
public function __construct()
{
$endpoint = $this;
if ($page = page('webmention') and kirby()->path() == $page->uri()) {
if (r::is('post')) {
try {
$endpoint->start();
header::status(202);
tpl::set('status', 'success');
tpl::set('alert', null);
} catch (Exception $e) {
header::status(400);
tpl::set('status', 'error');
tpl::set('alert', $e->getMessage());
}
} else {
tpl::set('status', 'idle');
}
} else {
kirby()->routes(array(array('pattern' => 'webmention', 'method' => 'GET|POST', 'action' => function () use($endpoint) {
try {
$endpoint->start();
echo response::success('Yay', 202);
} catch (Exception $e) {
echo response::error($e->getMessage());
}
})));
}
}
开发者ID:aizlewood,项目名称:2016,代码行数:29,代码来源:endpoint.php
示例12: sys_sync
/**
* System interfaces syncronization
* @access protected
*/
protected function sys_sync()
{
// Сбросить со всех записей признака проверен (поле check)
$this->_flush();
$this->insert_on_empty = false;
$this->push_args(array('exist' => 0, '_sexist' => 1));
$this->_set();
$this->pop_args();
$ep = data_interface::get_instance('entry_point');
$interfaces = array('ui' => $this->get_di_array(), 'di' => $this->get_ui_array());
$ep->register($interfaces);
// Удаляем все ТВ, которые в процессе синхронизации не были отмечены как существующие
$this->_flush();
$this->insert_on_empty = false;
$this->push_args(array('_sexist' => 0));
$this->_unset();
// Получаем массив ID удалённых записей и удаляем их из таблицы связей с группами
$epg = data_interface::get_instance('entry_point_group');
$ids = (array) $this->get_lastChangedId();
foreach ($ids as $id) {
$epg->remove_entry_point_from_groups($id);
}
$this->pop_args();
response::send(array('success' => true), 'json');
}
开发者ID:rigidus,项目名称:SBIN-DIESEL,代码行数:29,代码来源:interface.di.php
示例13: to
public function to($type)
{
if ($type == 'html' && $this->cfg->mode == 'edit') {
response::getInstance()->addJs('checkboxFields');
}
return parent::to($type);
}
开发者ID:nyroDev,项目名称:nyroFwk,代码行数:7,代码来源:fields.class.php
示例14: actionImprimirPDF
public function actionImprimirPDF()
{
$tUsuario = TUsuario::whereRaw('nombreUsuario=?', [Session::get('usuario')])->get();
$listaTDirectorio = TDirectorio::whereRaw('idUsuario=?', [$tUsuario[0]->idUsuario])->get();
Fpdf::AddPage();
Fpdf::SetFont('Arial', 'B', 16);
$i = 0;
Fpdf::Cell(40, 3 * $i, 'USUARIO');
Fpdf::Cell(50, 3 * $i, 'NOMBRE ');
Fpdf::Cell(50, 3 * $i, 'DIRECCION ');
Fpdf::Cell(40, 3 * $i, 'TELEFONO ', 0, 1, 'C');
$i++;
Fpdf::Cell(40, 3 * $i, '', 0, 1, 'C');
Fpdf::Cell(40, 3 * $i, '', 0, 1, 'C');
Fpdf::SetFont('Arial', '', 12);
foreach ($listaTDirectorio as $key => $value) {
Fpdf::Cell(40, 3 * $i, $value->tUsuario->nombreUsuario);
Fpdf::Cell(50, 3 * $i, $value->nombreCompleto);
Fpdf::Cell(50, 3 * $i, $value->direccion);
Fpdf::Cell(40, 3 * $i, $value->telefono, 0, 1, 'C');
$i++;
}
//Fpdf::Cell(40,10,'Hello World!');
// Fpdf::Output();
$header = ['Content-Type' => 'appication/pdf'];
return response::make(Fpdf::Output(), 200, $header);
}
开发者ID:Guerrerito,项目名称:laravelDirectorioTelefonico,代码行数:27,代码来源:otrosController.php
示例15: ajaxTrade
/**
* 异步获取数据 图表用
* @param null
* @return array
*/
public function ajaxTrade()
{
$postData = input::get();
//api的参数
$all = $this->__getParams('graphall', $postData, 'trade');
$datas = app::get('topshop')->rpcCall('sysstat.data.get', $all, 'seller');
return response::json($datas);
}
开发者ID:453111208,项目名称:bbc,代码行数:13,代码来源:sysbusiness.php
示例16: __construct
/**
* Constructor
*
* @param string $uri The URI to route
* @param string $domain The domain to route
* @param bool $secure True if connection made via SSL
*/
public function __construct($buri = '/')
{
if (isset($_SERVER['REQUEST_URI'])) {
$uri = $_SERVER['REQUEST_URI'];
} else {
$uri = $buri;
}
if (isset($_SERVER['HTTP_HOST'])) {
$domain = strtolower($_SERVER['HTTP_HOST']);
} else {
if (isset($_SERVER['SERVER_NAME'])) {
$domain = strtolower($_SERVER['SERVER_NAME']);
} else {
$domain = 'localhost';
}
}
$secure = true;
// Parse query string
if (strpos($uri, '?')) {
$base = substr($uri, 0, strpos($uri, '?'));
$rest = substr($uri, strpos($uri, '?') + 1);
// Apache mod_rewrite workaround for existing folders - requests
// are routed as /uri/?/uri if the folder exists.
if ($base != '/' && file_exists('.' . $base) && substr($rest, 0, strlen($base) - 1) . '/' == $base) {
// folder match, reroute the $rest.
// TODO: Query string arguments should be passed on
if (strpos($rest, '&') > 0) {
$params = substr($rest, strpos($rest, '&') + 1);
}
response::redirect($base . '?' . $params);
} else {
// Parse the querystring
$qsl = explode('&', $rest);
foreach ($qsl as $qsi) {
if (preg_match('/^(.*)=(.*)$/', $qsi, $keys)) {
$_GET[$keys[1]] = urldecode($keys[2]);
$_REQUEST[$keys[1]] = urldecode($keys[2]);
}
}
$uri = $base;
}
}
// Quick fix for first index being '/index_php' when invoked via
// apache - hopefully sorts bug with php oauth.
if (arr::hasKey($_GET, '/index_php')) {
array_shift($_GET);
array_shift($_GET);
}
// Assign the URI and start parsing
$this->_uri = $uri;
$this->_domain = $domain;
$this->_secure = request::isSecure();
foreach (explode('/', $this->_uri) as $segment) {
if ($segment != '') {
$this->_urisegments[] = $segment;
}
}
}
开发者ID:noccy80,项目名称:lepton-ng,代码行数:65,代码来源:router.php
示例17: slot
/**
* @desc
* @param type $name
* @param type $data
* @example TView::slot
*/
public function slot($name, $isDisplay = true)
{
$file = self::_getSlotPath($name);
$data = $this->_fetchTpl($file, $this->data);
if (!$isDisplay) {
return $data;
}
response::output($data);
}
开发者ID:hiloy,项目名称:autophp,代码行数:15,代码来源:default.php
示例18: run
/**
* Performs the fetch of the current status
*
* @param $params
* Associative array of parameters
* - $params->wr: Work Request ID
* - $params->user: User ID making the request
* @return
* A character corresponding to the current status on success
* FALSE is permission denied
* NULL if no work request
*/
function run($params)
{
$request_id = $params['GET']['wr'];
$access = access::getInstance();
if ($access->permitted('wr/view', $request_id)) {
$result = db_query('SELECT * FROM request_status WHERE request_id = %d ORDER BY status_on DESC LIMIT 1', $request_id);
if (db_num_rows($result) > 0) {
$response = new response('Success');
$object = new WrmsStatus();
$object->populate(db_fetch_object($result));
$response->set('status', $object);
return $response;
}
return new error('No status records found for that Work Request. Please ensure the WR exists.', 400);
} else {
return new error('Access denied', 403);
}
}
开发者ID:Br3nda,项目名称:medusa,代码行数:30,代码来源:wrms_request_status_getCurrentStatus.php
示例19: redirect_response
function redirect_response($status = RESPONSE_STATUS_SUCCESS, $url = '')
{
if (!$url) {
$this->url = $_SERVER['PHP_SELF'];
} else {
$this->url = $url;
}
parent::response($status);
}
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:9,代码来源:redirect_response.class.php
示例20: getItemPic
/**
* 根据itemId获取图片
*/
public function getItemPic()
{
$itemId = input::get('itemIds');
$picData = kernel::single('sysitem_item_info')->getItemDefaultPic($itemId);
if ($picData[$itemId]['image_default_id']) {
$result['url'] = $picData[$itemId]['image_default_id'];
}
return response::json($result);
}
开发者ID:453111208,项目名称:bbc,代码行数:12,代码来源:image.php
注:本文中的response类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论