本文整理汇总了PHP中CakeRequest::data方法的典型用法代码示例。如果您正苦于以下问题:PHP CakeRequest::data方法的具体用法?PHP CakeRequest::data怎么用?PHP CakeRequest::data使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CakeRequest
的用法示例。
在下文中一共展示了CakeRequest::data方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _checkFields
/**
* Checks the fields to ensure they are supplied.
*
* @param CakeRequest $request The request that contains login information.
* @param string $model The model used for login verification.
* @param array $fields The fields to be checked.
* @return boolean False if the fields have not been supplied. True if they exist.
*/
protected function _checkFields(CakeRequest $request, $model, $fields) {
if (empty($request->data[$model])) {
return false;
}
foreach (array($fields['username'], $fields['password']) as $field) {
$value = $request->data($model . '.' . $field);
if (empty($value) || !is_string($value)) {
return false;
}
}
return true;
}
示例2: authenticate
public function authenticate(CakeRequest $request, CakeResponse $response)
{
$params = json_decode($request->query('params'), true);
if (!isset($params['username'])) {
$params = json_decode($request->data('params'), true);
}
$options = array('conditions' => array('User.username' . $this->userController->User->username => $params['username']));
$result = $this->userController->User->find('first', $options);
if ($result) {
$password = sha1($result['User']['username'] . $result['User']['password']);
if ("Promobot" . $password == $params['auth']) {
return $result['User'];
}
}
return false;
}
示例3: testDataWritingFalsey
/**
* Test writing falsey values.
*
* @return void
*/
public function testDataWritingFalsey()
{
$request = new CakeRequest('posts/index');
$request->data('Post.null', null);
$this->assertNull($request->data['Post']['null']);
$request->data('Post.false', false);
$this->assertFalse($request->data['Post']['false']);
$request->data('Post.zero', 0);
$this->assertSame(0, $request->data['Post']['zero']);
$request->data('Post.empty', '');
$this->assertSame('', $request->data['Post']['empty']);
}
示例4: checkFields
/**
* Checks the fields to ensure they are supplied.
*
* @param CakeRequest $request The request that contains login information.
* @param string $model The model used for login verification.
* @return bool False if the fields have not been supplied. True if they exist.
*/
protected function checkFields(CakeRequest $request, $model)
{
if (empty($request->data[$model])) {
return false;
}
foreach (array($this->settings['fields']['username'], $this->settings['fields']['password']) as $field) {
$value = $request->data($model . '.' . $field);
if (empty($value) && $value !== '0' || !is_string($value)) {
return false;
}
}
return true;
}
示例5: setConditionContent
private static function setConditionContent(stdClass $std, CakeRequest $request)
{
$paginateOrmName = self::PAGINATE_ORM_NAME;
$value = $request->data(['CategoriesSearch']);
if (!empty($value['content'])) {
$fieldName = $paginateOrmName . '.content Like';
$std->conditions[0]['or'][$fieldName] = '%' . $value['content'] . '%';
}
}