当前位置: 首页>>代码示例>>PHP>>正文


PHP r::get方法代码示例

本文整理汇总了PHP中r::get方法的典型用法代码示例。如果您正苦于以下问题:PHP r::get方法的具体用法?PHP r::get怎么用?PHP r::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在r的用法示例。


在下文中一共展示了r::get方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: get

/**
 * Shortcut for r::get()
 *
 * @param   mixed    $key The key to look for. Pass false or null to return the entire request array. 
 * @param   mixed    $default Optional default value, which should be returned if no element has been found
 * @return  mixed
 * @package Kirby
 */
function get($key = false, $default = null)
{
    return r::get($key, $default);
}
开发者ID:sdvig,项目名称:kirbycms,代码行数:12,代码来源:kirby.php

示例2: redirect

 /**
  * Redirect to a specific page.
  *
  * @param   string  $target   Page to redirect to.
  * @param   array   $data     Optional data to save in a users session.
  */
 protected function redirect($target, $data = null)
 {
     // Write optional session data
     if ($data instanceof Messages) {
         Session::flash('errors', $data->toArray());
     } else {
         if (is_array($data)) {
             Session::flash($data);
         } else {
             if (!is_null($data)) {
                 Session::flash('data', $data);
             }
         }
     }
     // Allow to specify the redirect uri as parameter
     $url = r::get('redirect_to');
     if (!empty($url)) {
         redirect::to($url);
     }
     // Perform redirect
     switch ($target) {
         case 'home':
             redirect::home();
             break;
         case 'back':
             redirect::back();
             break;
         case '404':
             $page = site()->errorPage();
             redirect::to($page->uri());
             break;
         case 'referer':
             $referer = server::get('HTTP_REFERER');
             redirect::to($referer);
             break;
         default:
             redirect::to($target);
             break;
     }
 }
开发者ID:buditanrim,项目名称:kirby-comments,代码行数:46,代码来源:controller.php

示例3: isBot

 /**
  * Test if any of the honeypot fields are filled.
  *
  * @return  boolean
  */
 protected function isBot()
 {
     // Honeypot spam prevention
     $config = $this->hub()->config();
     $method = $config->get('honeypot');
     switch ($method) {
         case 'css':
             $field = $config->get('honeypot.name', 'url');
             $value = r::get($field);
             return !empty($value);
         case 'js':
             $field = $config->get('honeypot.name', 'legit');
             $value = r::get($field);
             return 1 !== intval($value);
     }
     // Time based spam prevention
     $threshold = $config->get('requiredReadingTime', 0);
     if ($threshold > 0) {
         $now = time();
         $time = r::get('tictoc');
         return $now - $time < $threshold;
     }
     return false;
 }
开发者ID:buditanrim,项目名称:kirby-comments,代码行数:29,代码来源:comment.php

示例4: fetchData

 static function fetchData($template = false, $input = false)
 {
     if (!$input) {
         $input = r::get();
     }
     if ($template) {
         $params = settings::load($template);
         $fields = $params['fields'];
     } else {
         global $settings;
         $fields = $settings->fields;
     }
     $data = array();
     foreach ($fields as $key => $value) {
         $data[$key] = a::get($input, $key);
     }
     return $data;
 }
开发者ID:nilshendriks,项目名称:kirbycms-panel,代码行数:18,代码来源:data.php

示例5: testRemove

 public function testRemove()
 {
     r::remove('testvar');
     $this->assertFalse(isset($_REQUEST['testvar']));
     $this->assertNull(r::get('testvar'));
 }
开发者ID:aoimedia,项目名称:kosmonautensofa,代码行数:6,代码来源:RTest.php

示例6: json_decode

$giphy_json = json_decode(file_get_contents($giphy_endpoint . $term));
$giphy_data = $giphy_json->data;
if (!count($giphy_data)) {
    echo "No gifs for " . $term;
    return;
} else {
    if (empty($term)) {
        $url = $giphy_data->image_original_url;
    } else {
        if (is_array($giphy_data)) {
            $url = $giphy_data[array_rand($giphy_data)]->images->original->url;
        } else {
            $url = $giphy_data->images->original->url;
        }
    }
}
header("HTTP/1.1 200 OK");
$json = array('payload' => json_encode(array('unfurl_links' => true, 'text' => '<' . $url . '|' . (!empty($text) ? $text : '') . '>', 'channel' => !empty($channel_name) ? '#' . $channel_name : null, 'username' => $botname . ($show_name && !empty($user_name) ? ' :: ' . $user_name : ''))));
// If no slack request token, just render out the gif result to the page
if (!r::get('token', null)) {
    echo '<img src="' . $url . '" />';
} else {
    // Get cURL resource
    $curl = curl_init();
    // Set some options - we are passing in a useragent too here
    curl_setopt_array($curl, array(CURLOPT_URL => $webhook_url, CURLOPT_POST => 1, CURLOPT_RETURNTRANSFER => true, CURLOPT_POSTFIELDS => $json));
    // Send the request & save response to $resp
    $resp = curl_exec($curl);
    // Close request to clear up some resources
    curl_close($curl);
}
开发者ID:GilbertMiao,项目名称:gifbot,代码行数:31,代码来源:index.php


注:本文中的r::get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。