本文整理汇总了PHP中Request函数的典型用法代码示例。如果您正苦于以下问题:PHP Request函数的具体用法?PHP Request怎么用?PHP Request使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Request函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
/**
* @return array
* @throws \yii\web\NotFoundHttpException
*/
public function run()
{
/* @var $modelClass \cookyii\modules\Feed\resources\FeedSection\Model */
$modelClass = $this->modelClass;
$with_deleted = Request()->get('deleted', 'false') === 'true';
return $modelClass::getTree($with_deleted);
}
示例2: __construct
function __construct()
{
global $_CONFIGS;
$this->initTime = $this->getMicroTime();
$this->DB = new DB();
if ($_CONFIGS->installed === true) {
$this->Event = new Event($this);
$this->Addon = new Addon($this);
$this->Module = new Module($this);
$this->Cache = new Cache($this);
}
$this->table = new stdClass();
$this->table->site = 'site_table';
$this->table->page = 'page_table';
$this->table->article = 'article_table';
$this->timezone = 'Asia/Seoul';
$this->domain = strtolower($_SERVER['HTTP_HOST']);
$this->site = null;
$this->language = Request('language');
$this->menu = Request('menu') == null ? 'index' : Request('menu');
$this->page = Request('page') == null ? null : Request('page');
$this->view = Request('view') == null ? null : Request('view');
$this->idx = Request('idx') == null ? null : Request('idx');
date_default_timezone_set($this->timezone);
$this->addSiteHeader('script', __IM_DIR__ . '/scripts/jquery.1.11.2.min.js');
$this->addSiteHeader('script', __IM_DIR__ . '/scripts/default.js');
$this->addSiteHeader('script', __IM_DIR__ . '/scripts/moment.js');
}
示例3: emplist
/**
* Display a listing the employees.
*
* @return \Illuminate\Http\Response
*/
public function emplist()
{
$str = \Request()->getRequestUri();
$id = substr($str, strrpos($str, '/') + 1, strlen($str));
$params = array('View' => Str::title($id) . ' Employee List', 'Description' => 'Manage your <strong>' . Str::title($id) . '</strong> employee records here.');
return view('employees.list', compact($params));
}
示例4: RequestNumber
function RequestNumber($sParameterName, $nMin, $nMax, $nDefault)
{
$nReturn = intval(Request($sParameterName));
if (!($nReturn >= $nMin && $nReturn <= $nMax)) {
$nReturn = $nDefault;
}
return $nReturn;
}
示例5: RequestString
function RequestString($sParameterName, $nMaxLength)
{
$sReturn = Request($sParameterName);
if (strlen($sReturn) > $nMaxLength) {
$sReturn = substr($sReturn, 0, $nMaxLength);
}
return str_replace("'", "", $sReturn);
}
示例6: checkUseSsl
public function checkUseSsl($send_redirect = false)
{
$redirect = true === USE_SSL && (!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] !== 'on');
if (true === $send_redirect) {
if (true === $redirect) {
Response()->redirect('https://' . Request()->serverName . Request()->url)->send();
exit;
}
}
return $redirect;
}
示例7: actionIn
/**
* @return array
*/
public function actionIn()
{
$result = ['result' => false, 'message' => ['title' => \Yii::t('account', 'Sign In'), 'text' => \Yii::t('account', 'Unknown error.')]];
$SignInForm = \Yii::createObject(Account\crm\forms\SignInForm::className());
if ($SignInForm->load(Request()->post()) && $SignInForm->validate() && $SignInForm->login()) {
$result = ['result' => true, 'message' => ['title' => \Yii::t('account', 'Sign In'), 'text' => \Yii::t('account', 'Welcome!')], 'redirect' => UrlManager()->createUrl(['/'])];
}
if ($SignInForm->hasErrors()) {
$result = ['result' => false, 'message' => ['title' => \Yii::t('account', 'Sign In'), 'text' => \Yii::t('account', 'Form errors.')], 'errors' => $SignInForm->getFirstErrors()];
}
return $result;
}
示例8: run
/**
* @return array
* @throws \yii\base\Exception
* @throws \yii\web\BadRequestHttpException
* @throws \yii\web\NotFoundHttpException
*/
public function run()
{
$client_id = (int) Request()->post('client_id');
if (empty($client_id)) {
throw new \yii\web\BadRequestHttpException();
}
/** @var \cookyii\modules\Client\resources\Client\Model $Client */
$Client = $this->findModel($client_id);
if (!$Client->accountHelper->unlink()) {
$result = ['result' => false, 'message' => \Yii::t('cookyii.client', 'Failed to unlink account')];
} else {
$result = ['result' => true, 'message' => \Yii::t('cookyii.client', 'Account unlink successfully')];
}
return $result;
}
示例9: getDataFromSoap
/**
* 2012年5月14日 携程 唐春龙 研发中心
* 通过SOAP调用远程webservice服务(返回一个XML)
* @param $url 远程服务的地址
* @param $parameters 远程服务的参数数组
* @param $funcName 远程服务的函数的名称
* @param 返回XML
*/
function getDataFromSoap($url, $funcName, $parameters)
{
//$parameters是服务中函数的变量名与值之间的对应数组
//调用指定的URL
$soap = new SoapClient($url);
try {
Request($parameters);
$coutw = $soap->{$funcName}($parameters);
// echo json_encode($coutw);
return $coutw;
} catch (SoapFault $fault) {
//发生异常时输出
return $fault->faultcode;
}
}
示例10: prepareListDataProvider
/**
* @param \yii\rest\Action $action
* @return \yii\data\ActiveDataProvider
*/
public function prepareListDataProvider($action)
{
/* @var $modelClass PageModel */
$modelClass = $action->modelClass;
$Query = $modelClass::find();
$search = str_clean(Request()->get('search'));
if (!empty($search)) {
$Query->search($search);
}
$deleted = Request()->get('deleted');
if ($deleted === 'false') {
$Query->withoutDeleted();
}
return new \yii\data\ActiveDataProvider(['query' => $Query, 'pagination' => ['pageSize' => 15]]);
}
示例11: notice
public function notice()
{
$data = Request()->all();
if (!isset($data['type'])) {
abort(400, 'fail');
}
$config = config('pingpp');
if (!empty($config['pub_key'])) {
$result = openssl_verify(Request()->getContent(), base64_decode(Request()->header('x-pingplusplus-signature')), trim($config['pub_key']), OPENSSL_ALGO_SHA256);
if ($result !== 1) {
abort(403, 'fail');
}
}
return $data;
}
示例12: run
/**
* @return array
* @throws \yii\base\Exception
* @throws \yii\web\BadRequestHttpException
* @throws \yii\web\NotFoundHttpException
*/
public function run()
{
$client_id = (int) Request()->post('client_id');
if (empty($client_id)) {
throw new \yii\web\BadRequestHttpException();
}
/** @var \cookyii\modules\Client\resources\Client\Model $Client */
$Client = $this->findModel($client_id);
$Account = $Client->accountHelper->create();
if ($Account->hasErrors()) {
$result = ['result' => false, 'message' => \Yii::t('cookyii.client', 'Failed to create account'), 'errors' => $Account->getFirstErrors()];
} else {
$result = ['result' => true, 'message' => \Yii::t('cookyii.client', 'Account created successfully'), 'account_id' => $Account->id];
}
return $result;
}
示例13: prepareListDataProvider
/**
* @param \yii\rest\Action $action
* @return \yii\data\ActiveDataProvider
*/
public function prepareListDataProvider($action)
{
/* @var $modelClass FeedItemModel */
$modelClass = $action->modelClass;
$Query = $modelClass::find();
$section = str_clean(Request()->get('section'));
if (!empty($section)) {
$Query->bySectionSlug($section);
}
$search = str_clean(Request()->get('search'));
if (!empty($search)) {
$Query->search($search);
}
$deleted = Request()->get('deleted');
if ($deleted === 'false') {
$Query->withoutDeleted();
}
$Query->orderBy(['sort' => SORT_DESC]);
return new \yii\data\ActiveDataProvider(['query' => $Query, 'pagination' => ['pageSize' => 10]]);
}
示例14: actionDelete
/**
* @return array
* @throws \Exception
* @throws \yii\web\BadRequestHttpException
* @throws \yii\web\NotFoundHttpException
*/
public function actionDelete()
{
$result = ['result' => false, 'message' => \Yii::t('account', 'Unknown error')];
$account_id = (int) Request()->get('account_id');
$key = str_clean(Request()->get('key'));
if (empty($account_id)) {
throw new \yii\web\BadRequestHttpException('Empty account id');
}
/** @var \cookyii\modules\Account\resources\AccountProperty $AccountPropertyModel */
$AccountPropertyModel = \Yii::createObject(\cookyii\modules\Account\resources\AccountProperty::className());
$Property = $AccountPropertyModel::find()->byAccountId($account_id)->byKey($key)->one();
if (empty($Property)) {
throw new \yii\web\NotFoundHttpException('Property not found');
}
if ($Property->delete() === false) {
$result = ['result' => false, 'message' => \Yii::t('account', 'Unable to remove a property')];
} else {
$result = ['result' => true, 'message' => \Yii::t('account', 'Property was successfully removed')];
}
return $result;
}
示例15: run
/**
* @return array
*/
public function run()
{
$result = ['result' => false, 'message' => \Yii::t('account', 'Unknown error')];
$account_id = (int) Request()->post('account_id');
/** @var $modelClass \cookyii\modules\Account\resources\Account */
$modelClass = $this->modelClass;
$Account = null;
if ($account_id > 0) {
$Account = $modelClass::find()->byId($account_id)->one();
}
if (empty($Account)) {
$Account = new $modelClass();
}
$AccountEditForm = \Yii::createObject(['class' => Account\backend\forms\AccountEditForm::className(), 'Account' => $Account]);
$AccountEditForm->load(Request()->post()) && $AccountEditForm->validate() && $AccountEditForm->save();
if ($AccountEditForm->hasErrors()) {
$result = ['result' => false, 'message' => \Yii::t('account', 'When executing a query the error occurred'), 'errors' => $AccountEditForm->getFirstErrors()];
} else {
$result = ['result' => true, 'message' => \Yii::t('account', 'Account successfully saved'), 'account_id' => $Account->id];
}
return $result;
}