當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Request函數代碼示例

本文整理匯總了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);
 }
開發者ID:cookyii,項目名稱:module-feed,代碼行數:11,代碼來源:TreeAction.php

示例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');
 }
開發者ID:parangma,項目名稱:iModule3,代碼行數:28,代碼來源:iModule.class.php

示例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));
 }
開發者ID:ajamiscosa,項目名稱:devexam,代碼行數:12,代碼來源:EmployeeController.php

示例4: RequestNumber

function RequestNumber($sParameterName, $nMin, $nMax, $nDefault)
{
    $nReturn = intval(Request($sParameterName));
    if (!($nReturn >= $nMin && $nReturn <= $nMax)) {
        $nReturn = $nDefault;
    }
    return $nReturn;
}
開發者ID:spletnasoba,項目名稱:whmcs-module-gateway-moneta,代碼行數:8,代碼來源:moneta_potrditev.php

示例5: RequestString

function RequestString($sParameterName, $nMaxLength)
{
    $sReturn = Request($sParameterName);
    if (strlen($sReturn) > $nMaxLength) {
        $sReturn = substr($sReturn, 0, $nMaxLength);
    }
    return str_replace("'", "", $sReturn);
}
開發者ID:spletnasoba,項目名稱:whmcs-module-gateway-moneta,代碼行數:8,代碼來源:moneta_callback.php

示例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;
 }
開發者ID:rmrevin,項目名稱:yii2-application,代碼行數:11,代碼來源:UseSslTrait.php

示例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;
 }
開發者ID:arooth,項目名稱:module-account,代碼行數:15,代碼來源:ApiController.php

示例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;
 }
開發者ID:cookyii,項目名稱:module-client,代碼行數:21,代碼來源:UnlinkAccountAction.php

示例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;
    }
}
開發者ID:Yougmark,項目名稱:TiCheck_Server,代碼行數:23,代碼來源:soapData.php

示例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]]);
 }
開發者ID:cookyii,項目名稱:module-page,代碼行數:19,代碼來源:PageController.php

示例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;
 }
開發者ID:lyt8384,項目名稱:pingpp-laravel5-plus,代碼行數:15,代碼來源:PingppCollertion.php

示例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;
 }
開發者ID:cookyii,項目名稱:module-client,代碼行數:22,代碼來源:CreateAccountAction.php

示例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]]);
 }
開發者ID:cookyii,項目名稱:module-feed,代碼行數:24,代碼來源:ItemController.php

示例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;
 }
開發者ID:arooth,項目名稱:module-account,代碼行數:27,代碼來源:PropertyController.php

示例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;
 }
開發者ID:arooth,項目名稱:module-account,代碼行數:25,代碼來源:EditFormAction.php


注:本文中的Request函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。