• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP R类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: createService

 /**
  * @param ServiceLocatorInterface $serviceLocator
  * @return R
  */
 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     $rjhRedbeanService = new R();
     $config = $serviceLocator->get('config');
     $rjhRedbeanConfig = $config['rjhredbean'];
     $connection = $rjhRedbeanConfig['connection'];
     $dsn = $connection['dsn'];
     $user = $connection['user'];
     $password = $connection['password'];
     $rjhRedbeanService->setup($dsn, $user, $password);
     $rjhRedbeanService->freeze($rjhRedbeanConfig['freeze']);
     $rjhRedbeanService->debug($rjhRedbeanConfig['debug']);
     return $rjhRedbeanService;
 }
开发者ID:richardjh,项目名称:rjhredbean,代码行数:18,代码来源:RjhRedbeanServiceFactory.php


示例2: testTainted

 /**
  * Test tainted.
  * 
  * @return void
  */
 public function testTainted()
 {
     testpack('Original Tainted Tests');
     $redbean = R::$redbean;
     $spoon = $redbean->dispense("spoon");
     asrt($spoon->getMeta("tainted"), TRUE);
     $spoon->dirty = "yes";
     asrt($spoon->getMeta("tainted"), TRUE);
     testpack('Tainted List test');
     $note = R::dispense('note');
     $note->text = 'abc';
     $note->ownNote[] = R::dispense('note')->setAttr('text', 'def');
     $id = R::store($note);
     $note = R::load('note', $id);
     asrt($note->isTainted(), FALSE);
     // Shouldn't affect tainted
     $note->text;
     asrt($note->isTainted(), FALSE);
     $note->ownNote;
     asrt($note->isTainted(), TRUE);
     testpack('Tainted Test Old Value');
     $text = $note->old('text');
     asrt($text, 'abc');
     asrt($note->hasChanged('text'), FALSE);
     $note->text = 'xxx';
     asrt($note->hasChanged('text'), TRUE);
     $text = $note->old('text');
     asrt($text, 'abc');
     testpack('Tainted Non-exist');
     asrt($note->hasChanged('text2'), FALSE);
     testpack('Misc Tainted Tests');
     $bean = R::dispense('bean');
     $bean->hasChanged('prop');
     $bean->old('prop');
 }
开发者ID:daviddeutsch,项目名称:redbean-adaptive,代码行数:40,代码来源:Tainted.php


示例3: do_stuff

function do_stuff()
{
    /* 26.9|0.0|0.0|31.4|0.00|0.00|0.00|0.00 */
    $result = file_get_contents('http://ourproject.dyndns-server.com:8099/&');
    echo $result;
    $rs = explode('|', $result);
    echo "\n";
    $now = new DateTime();
    $b = R::dispense('timedate');
    $b->time = $now->format('Y-m-d H:i:s');
    $b->T1 = $rs[0];
    $b->T2 = $rs[1];
    $b->T3 = $rs[2];
    $b->T4 = $rs[3];
    $b->V1 = $rs[4];
    $b->V2 = $rs[5];
    $b->V3 = $rs[6];
    $b->V4 = $rs[7];
    R::store($b);
    echo $b->time;
    echo "\n";
    // MySQL datetime format
    sleep(10);
    // wait 20 seconds
    do_stuff();
    // call this function again
}
开发者ID:limweb,项目名称:webappservice,代码行数:27,代码来源:index.php


示例4: getUserExternalSystemIds

 public static function getUserExternalSystemIds()
 {
     $columnName = ExternalSystemIdUtil::EXTERNAL_SYSTEM_ID_COLUMN_NAME;
     RedBeanColumnTypeOptimizer::externalIdColumn(User::getTableName('User'), $columnName);
     $sql = 'select ' . $columnName . ' from ' . User::getTableName('User');
     return R::getCol($sql);
 }
开发者ID:sandeep1027,项目名称:zurmo_,代码行数:7,代码来源:UserValueTypeSanitizerUtil.php


示例5: register

    function register($data)
    {
        try {
            include_once 'dbcon.php';
        } catch (Exception $e) {
            ?>
<script type="text/javascript">
alert("Unable to connect to DB, Please contact Administrator");
</script>
<?php 
        }
        $admin->uname = $username;
        $admin->password = $password;
        $admin->sh_name = $shName;
        $admin->full_name = $fullName;
        $admin->desc = $desc;
        $admin->location = $location;
        $admin->address = $address;
        $admin->date_added = $dateAdded;
        $admin->estd_year = $estddate;
        try {
            R::store($admin);
        } catch (Exception $e) {
            ?>
<script type="text/javascript">
			alert("Unable to save to DB, Please contact Administrator");
			</script>
<?php 
        }
    }
开发者ID:4sujittiwari,项目名称:AdminPanel,代码行数:30,代码来源:registermodel.php


示例6: get_pima_controls_reported

 public function get_pima_controls_reported($user_group_id, $user_filter_used, $from, $to)
 {
     $sql = "CALL get_pima_controls_reported('" . $from . "','" . $to . "'," . $user_group_id . "," . $user_filter_used . ")";
     $res = R::getAll($sql);
     // print_r($res);die();
     return $res;
 }
开发者ID:OmondiKevin,项目名称:CD4,代码行数:7,代码来源:poc_model.php


示例7: save

 public function save()
 {
     GUMP::add_validator("unique", function ($field, $input, $param = NULL) {
         $checkExistingUser = R::findOne('user', 'user=?', array($input));
         if ($checkExistingUser == NULL) {
             return FALSE;
         } else {
             return TRUE;
         }
     });
     GUMP::add_validator("strong", function ($field, $input, $param = NULL) {
         return checkPasswordStrength($input);
     });
     $rules = array('reseller_username' => 'required|alpha_numeric|max_len,10|min_len,6|unique', 'reseller_password' => 'required|max_len,10|min_len,7|strong');
     $filters = array('reseller_username' => 'trim|sanitize_string', 'reseller_password' => 'trim|sanitize_string|md5');
     $app = Slim::getInstance();
     $post = $app->request()->post();
     // $app - Slim main app instance
     $postValues = $gump->filter($post, $filters);
     $validated = $gump->validate($gump->filter($postValues, $filters), $rules);
     if ($validated === TRUE) {
         $createUser = R::dispense('user');
         $createUser->user = $postValues['reseller_username'];
         $createUser->user = $postValues['reseller_password'];
     } else {
         $this->setError($gump->get_readable_errors(true));
     }
     if ($this->getError() == "") {
         $this->fails = FALSE;
     } else {
         $this->fails = TRUE;
     }
 }
开发者ID:bogiesoft,项目名称:Slim_PHP_Project,代码行数:33,代码来源:reseller_library.php


示例8: update_facilities

 public function update_facilities($id)
 {
     $sql = "SELECT \n\t\t\t\t\t  `facility_id`,\n\t\t\t\t\t  `equipment_id`,\n                      `serial_number`,\n                      `ctc_id_no`\n\t\t\t\tFROM `facility_equipment_request`\n\t\t\t\tWHERE id = {$id}";
     $facilty = R::getAll($sql);
     //print_r($facilty); die();
     /*foreach ($facilty as $key => $val) {
     			$db = $val;
     				$tumepata = implode(',', $db);
     				echo $tumepata;
     		}
             die;*/
     if ($facilty[0]['equipment_id'] == 4) {
         $facility_equipment_registration = array('id' => NULL, 'facility_id' => $facilty[0]['facility_id'], 'equipment_id' => $facilty[0]['equipment_id'], 'status' => '1', 'deactivation_reason' => ' ', 'date_added' => NULL, 'date_removed' => NULL, 'serial_number' => $facilty[0]['serial_number']);
         $insert = $this->db->insert('facility_equipment', $facility_equipment_registration);
         $asus = $this->db->insert_id();
         $facility_registration = array('id' => NULL, 'facility_equipment_id' => $asus, 'serial_num' => $facilty[0]['serial_number'], 'ctc_id_no' => $facilty[0]['ctc_id_no']);
         //print_r($facility_registration);die;
         $insert = $this->db->insert('facility_pima', $facility_registration);
         // $asus = $this->db->insert_id();
         // $faciility_pima_id = array(
         // 							'facility_equipment_id'    =>   $asus
         // 							);
         // $this->db->where('id', $asus);
         // $this->db->update('facility_pima', $faciility_pima_id);
         //print_r($asus); die();
         return $insert;
     } else {
         $facility_registration = array('id' => NULL, 'facility_id' => $facilty[0]['facility_id'], 'equipment_id' => $facilty[0]['equipment_id'], 'status' => '1', 'deactivation_reason' => '', 'date_added' => NULL, 'date_removed' => NULL, 'serial_number' => $facilty[0]['serial_number']);
         $insert = $this->db->insert('facility_equipment', $facility_registration);
         return $insert;
     }
 }
开发者ID:OmondiKevin,项目名称:CD4,代码行数:32,代码来源:admin_model.php


示例9: execute

 static function execute($number = 5)
 {
     if (!is_numeric($number)) {
         throw new Exception('Number must be numeric');
     }
     $callables = R::findAll('queueitem', 'status = "open" ORDER BY id DESC LIMIT ' . $number);
     $c = 0;
     foreach (array_values($callables) as $index => $calleble) {
         $c++;
         if ($calleble->done) {
             $c--;
             continue;
         }
         if ($c >= $number) {
             break;
         }
         $serializer = new Serializer();
         $closure = $serializer->unserialize($calleble->callser);
         ////			$calleble->status = 'busy';
         //			R::store($calleble);
         $closure();
         $calleble->status = 'done';
         $calleble->done = true;
         $calleble->doneat = time();
         R::store($calleble);
     }
     return;
 }
开发者ID:g2design,项目名称:g2-modules,代码行数:28,代码来源:Queuer.php


示例10: delete_event

function delete_event($id)
{
    $event = R::load('events', $id);
    //reloads our event
    R::trash($event);
    //for one bean
}
开发者ID:sousatg,项目名称:events-backoffice,代码行数:7,代码来源:events.php


示例11: insertUser

 /**
  * @return int|string
  * @throws \RedBeanPHP\RedException
  */
 function insertUser()
 {
     $users = R::dispense('users');
     $users->fname = 'Abhishek';
     $users->lname = 'Saha';
     return R::store($users);
 }
开发者ID:ajaxtown,项目名称:eaglehorn,代码行数:11,代码来源:UserModel.php


示例12: process

 public function process(array $documents, &$context)
 {
     $doc = $documents[self::URL_MEDIA];
     $dom = self::getDOM($doc);
     $xpath = new DOMXPath($dom);
     //chapter count
     preg_match_all('#([0-9]+|Unknown)#', self::getNodeValue($xpath, '//span[text() = \'Chapters:\']/following-sibling::node()[self::text()]'), $matches);
     $chapterCount = Strings::makeInteger($matches[0][0]);
     //volume count
     preg_match_all('#([0-9]+|Unknown)#', self::getNodeValue($xpath, '//span[text() = \'Volumes:\']/following-sibling::node()[self::text()]'), $matches);
     $volumeCount = Strings::makeInteger($matches[0][0]);
     //serialization
     $serializationMalId = null;
     $serializationName = null;
     $q = $xpath->query('//span[text() = \'Serialization:\']/../a');
     if ($q->length > 0) {
         $node = $q->item(0);
         preg_match('#/magazine/([0-9]+)$#', $node->getAttribute('href'), $matches);
         $serializationMalId = Strings::makeInteger($matches[1]);
         $serializationName = Strings::removeSpaces($q->item(0)->nodeValue);
     }
     $media =& $context->media;
     $media->chapters = $chapterCount;
     $media->volumes = $volumeCount;
     $media->serialization_id = $serializationMalId;
     $media->serialization_name = $serializationName;
     R::store($media);
 }
开发者ID:Lucas8x,项目名称:graph,代码行数:28,代码来源:MangaSubProcessorBasic.php


示例13: __construct

 /**
  * Construct a new database object.
  * @param $settings
  */
 public function __construct($settings)
 {
     $this->database = DatabaseManager::connect($settings["host"], $settings["port"], $settings["user"], $settings["pass"], $settings["name"], isset($settings["utf8"]) ? $settings["utf8"] : true);
     // Debug
     global $settings;
     R::debug($settings["development"]);
 }
开发者ID:Rattatouille,项目名称:myaqa_test,代码行数:11,代码来源:Database.class.php


示例14: getSubscribers

function getSubscribers($id)
{
    $subs = R::getAll("select * from subscription where category_id='{$id}'");
    if ($subs) {
        return $subs;
    }
}
开发者ID:hiroyalty,项目名称:mhealth,代码行数:7,代码来源:pull.php


示例15: testForeignKeysWithSQLite

 /**
  * Test foreign keys with SQLite.
  * 
  * @return void
  */
 public function testForeignKeysWithSQLite()
 {
     $book = R::dispense('book');
     $page = R::dispense('page');
     $cover = R::dispense('cover');
     list($g1, $g2) = R::dispense('genre', 2);
     $g1->name = '1';
     $g2->name = '2';
     $book->ownPage = array($page);
     $book->cover = $cover;
     $book->sharedGenre = array($g1, $g2);
     R::store($book);
     $fkbook = R::getAll('pragma foreign_key_list(book)');
     $fkgenre = R::getAll('pragma foreign_key_list(book_genre)');
     $fkpage = R::getAll('pragma foreign_key_list(page)');
     asrt($fkpage[0]['from'], 'book_id');
     asrt($fkpage[0]['to'], 'id');
     asrt($fkpage[0]['table'], 'book');
     asrt(count($fkgenre), 2);
     if ($fkgenre[0]['from'] == 'book') {
         asrt($fkgenre[0]['to'], 'id');
         asrt($fkgenre[0]['table'], 'book');
     }
     if ($fkgenre[0]['from'] == 'genre') {
         asrt($fkgenre[0]['to'], 'id');
         asrt($fkgenre[0]['table'], 'genre');
     }
     asrt($fkbook[0]['from'], 'cover_id');
     asrt($fkbook[0]['to'], 'id');
     asrt($fkbook[0]['table'], 'cover');
 }
开发者ID:daviddeutsch,项目名称:redbean-adaptive,代码行数:36,代码来源:Foreignkeys.php


示例16: onPreDispatch

 public function onPreDispatch()
 {
     $dbms = isset($this->config['dbms']) ? $this->config['dbms'] : 'mysql';
     if ($dbms == 'sqlite') {
         if (!isset($this->config['database'])) {
             throw new \Empathy\MVC\Exception('sqlite database file not supplied.');
         }
         $db = DOC_ROOT . '/' . $this->config['database'];
         if (!file_exists($db)) {
             throw new \Empathy\MVC\Exception('sqlite database file not found.');
         }
         \R::setup('sqlite:' . $db);
     } else {
         if (!defined('DB_SERVER')) {
             throw new \Empathy\MVC\Exception('Database server is not defined in config.');
         }
         if (!$this->isIP(DB_SERVER)) {
             throw new \Empathy\MVC\Exception('Database server must be an IP address.');
         }
         $dsn = $dbms . ':host=' . DB_SERVER . ';dbname=' . DB_NAME . ';';
         if (defined('DB_PORT') && is_numeric(DB_PORT)) {
             $dsn .= 'port=' . DB_PORT . ';';
         }
         \R::setup($dsn, DB_USER, DB_PASS);
     }
 }
开发者ID:mikejw,项目名称:empathy,代码行数:26,代码来源:Redbean.php


示例17: create_group

 public function create_group($name)
 {
     $group = R::dispense('group');
     $group->name = $name;
     R::store($group);
     return $group;
 }
开发者ID:g2design,项目名称:g2-modules,代码行数:7,代码来源:Permission.php


示例18: _log_focus

function _log_focus($openid, $operation, $user_info = NULL)
{
    R::addDatabase('wechat_csc', $GLOBALS['db_wechat_csc_url'], $GLOBALS['db_wechat_csc_user'], $GLOBALS['db_wechat_csc_pass']);
    R::selectDatabase('wechat_csc');
    if (!R::testConnection()) {
        exit('DB failed' . PHP_EOL);
    }
    R::freeze(true);
    try {
        $user = R::getRedBean()->dispense('wxcsc_focus');
        $user->openid = $openid;
        $user->operation = $operation;
        if ($operation == 'focus' && $user_info != NULL) {
            $user->nickname = $user_info['nickname'];
            $user->sex = $user_info['sex'];
            $user->language = $user_info['language'];
            $user->city = $user_info['city'];
            $user->province = $user_info['province'];
            $user->country = $user_info['country'];
        }
        $user_id = R::store($user);
    } catch (Exception $e) {
        header('Content-type:text/json;charset=utf-8');
        echo json_encode(['result' => 'failed', 'error' => 'db error wechat', 'details' => $e->getMessage()]);
        die;
    }
    R::close();
}
开发者ID:adexbn,项目名称:gds_wechat,代码行数:28,代码来源:api_csc.php


示例19: view

 function view($args)
 {
     $id = array_shift($args);
     $permission = R::load('permission', $id);
     if (!is_numeric($id) && !$permission->getID()) {
         $this->redirect(PACKAGE_URL);
     }
     $allgroups = R::findAll('group');
     foreach ($allgroups as $key => $group) {
         foreach ($permission->sharedGroup as $group_c) {
             if ($group->id == $group_c->id) {
                 $allgroups[$key]->checked = true;
             }
         }
     }
     //		echo $permission->name;exit;
     $view = new G2_TwigView('pages/view');
     $view->permission = $permission;
     $view->allGroups = $allgroups;
     $form = new G2_FormMagic($view->get_render());
     if ($form->is_posted()) {
         $groups = R::loadAll('group', array_keys($form->data()['groups']));
         $permission->sharedGroup = $groups;
         R::store($permission);
         Admin_Alert::add_message("\"{$permission->name}\" permission was updated");
         $this->redirect(PACKAGE_URL);
     }
     echo $form->parse();
 }
开发者ID:g2design,项目名称:g2-modules,代码行数:29,代码来源:admin.php


示例20: countJobs

 public function countJobs($terms)
 {
     $terms = splitTerms($terms);
     $terms = implode('|', $terms);
     $jobs = R::findAll('jobs', " status=1 AND (title REGEXP :title OR description REGEXP :description OR perks REGEXP :perks OR how_to_apply REGEXP :how_to_apply OR company_name REGEXP :company_name)", array(':title' => $terms, ':description' => $terms, ':perks' => $terms, ':how_to_apply' => $terms, ':company_name' => $terms));
     return count($jobs);
 }
开发者ID:aescarcha,项目名称:jobskee-open-source-job-board,代码行数:7,代码来源:Search.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP RBAC类代码示例发布时间:2022-05-23
下一篇:
PHP Quote类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap